How to configure rsync Backup on nextcloudpi


I have my local server A and a remote one B.
I can log from A to B without password.

When I run ncp-config > backup > rsync, and then I have bunch of error messages :

rsync: failed to set times on "/media/myCloudDrive/ncdata": Operation not permitted (1)
rsync: opendir "/media/myCloudDrive/ncdata" failed: Permission denied (13)
rsync: recv_generator: failed to stat "/media/myCloudDrive/ncdata/.htaccess": Permission denied (13)
rsync: recv_generator: failed to stat "/media/myCloudDrive/ncdata/.ocdata": Permission denied (13)
rsync: recv_generator: failed to stat "/media/myCloudDrive/ncdata/index.html": Permission denied (13)

I followed this:

I test the rsync command from the doc with a fake folder, and it fails the same way.

What did I miss ?


Please post:
a.) full rsync command and user who execute the command
b.) ls -l on source-dir (eg. ls -l /media/myCloudDrive/ncdata) -> only this dir without subdirs
b.) ls -l on destination-dir (eg. ls -l /media/myCloudDrive/ncdata) -> only this dir without subdirs

Thanks @devnull for your reply:

I’m logged with ssh pi@hostA
(Greg is a test dir)

 $ sudo rsync -e 'ssh -p 22' -aAv Greg pi@hostB:/media/myCloudDrive/
sending incremental file list
rsync: recv_generator: mkdir "/media/myCloudDrive/Greg" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***

sent 249 bytes  received 172 bytes  280.67 bytes/sec
total size is 12,178  speedup is 28.93
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1207) [sender=3.1.3]

b) on hostA

$ ls -l
total 30612
drwxr-xr-x  2 pi pi     4096 Jul 31 22:16 Greg


$ sudo ls -l /media/SSDdriveNC/
total 24
drwx------  2 www-data www-data 16384 Jun 25 19:18 lost+found
drwxrwx--- 14 www-data www-data  4096 Aug 25 18:38 ncdata

c) on hostB

 $ ls -l
total 16
drwxr-xr-x 1 root root 12 Oct  8 12:02 myCloudDrive

I tried to change user:group root to www-data but the error remains

Is there anyone here to help me on that ?
@devnull ? @nachoparker ?
Thank in advance !

did you try to change it to pi:pi?

you connect as user pi to host b. so hostB:/media/myCloudDrive/ should be writeable to pi

Sorry for the long time.

On Pi2

sudo chown pi:pi /media/myCloudDrive

But after that i think you must change it back to www-data if you want there also use the webservice for the nextcloud-data. If it is only a backup nothing is to do.

sudo chown -R www-data-www-data /media/myCloudDrive

Please learn something about chown, …
Please do not only execute the commands.

great, thanks. It worked with sudo chown -R pi:pi /media/myCloudDrive (did not work without the -R)
I was confused with the different identities. It is just for backup, so I guess I don’t need to switch back to www-data.

Thanks for the clarification, it helped !