Ncp-backup to network drive fails

Nextcloud version (eg, 12.0.2): 16.0.4.1
NextCloudPi version v1.16.1
Operating system and version (eg, Ubuntu 17.04): Raspbian GNU/Linux 10 \n \l
NextCloudPi image NextCloudPi_07-21-19

The issue you are facing:
Can’t backup to network drive using ncp-backup. It seems to me the permissions on the network drive aren’t set correctly, but I can’t figure out the correct settings on my own.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. mount network drive
  2. start ncp-backup via TUI
  3. select existing folder on network drive

fstab entry for mounting the network drive:

//192.168.178.1/FRITZ.NAS/1TB /mnt/1TB/ cifs credentials=/home/pi/.smbcredentials,vers=1.0,uid=0,gid=0,x-systemd.automount,x-systemd.requires=network-online.target 0 0

I tried to mount the network drive as root, pi and as www-data, same result. Example showing mount for root:

pi@nextcloudpi:~ $ ls -l /mnt/1TB/
insgesamt 0
drwxrwxrwx 3 root root 0 Aug 30 19:22 FRITZ
drwxrwxrwx 2 root root 0 Aug 30 18:28 lost+found
drwxrwxrwx 4 root root 0 Sep  8 08:47 nextcloud

Output when trying to use ncp-backup:

Running nc-backup
check free space...
Maintenance mode enabled
backup database...
backup files...
chown: die Gruppe von '/mnt/1TB/nextcloud/nc-backups/nextcloud-bkp_20190908_1567930304.tar' wird ge▒ndert: Keine Berechtigung
Abort...
Maintenance mode disabled
Maintenance mode already disabled
Done. Press any key...

Commenting out the lines

#chmod 640 "$destfile"
#chown :www-data "$destfile"

in /usr/local/bin/ncp-backup solved the problem, but I don’t know yet if this breaks anything else. Furthermore, nc-rsync also doesnt’t work. I haven’t found a way to fix this yet:

Running nc-rsync
Maintenance mode enabled
Nextcloud is in maintenance mode - no apps have been loaded

rsync: chown "/mnt/1TB/nextcloud/nc-data-backup/ncdata" failed: Permission denied (13)
rsync: chown "/mnt/1TB/nextcloud/nc-data-backup/ncdata/.htaccess" failed: Permission denied (13)
rsync: chown "/mnt/1TB/nextcloud/nc-data-backup/ncdata/.ocdata" failed: Permission denied (13)
rsync: chown "/mnt/1TB/nextcloud/nc-data-backup/ncdata/index.html" failed: Permission denied (13)
....