I am trying to run a simple rsync script from my CentOS server to copy files and folders to a mounted NFS share on my Synology NAS. The NFS share is mounted to the CentOS server fine. I can create files and browse it without problems from the CentOS server. I have the NFS share mounted at /mnt/nfs/synology.

The directory I am looking to copy is located at ~/resilio-sync/websites. The rsync command is rsync -avz ~/resilio-sync/websites /mnt/nfs/synology If I do a dry run it shows me what's going to be copied just fine.

sending incremental file list
sent 6132 bytes  received 973 bytes  14210.00 bytes/sec
total size is 29217828  speedup is 4112.29 (DRY RUN)

When I try and run it for real I get this:

sending incremental file list
rsync: failed to set times on "/mnt/nfs/synology/websites": Operation not permitted (1)
rsync: recv_generator: mkdir "/mnt/nfs/synology/websites/.sync" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
rsync: recv_generator: mkdir "/mnt/nfs/synology/websites/test.co.uk" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***

sent 5196 bytes  received 37 bytes  10466.00 bytes/sec
total size is 29217828  speedup is 5583.38
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1052) [sender=3.0.9]

I'm guessing it's telling me that it's permission related, but the strange thing is that I can write to both the source and destination directories just fine if I am not using rsync.

Any ideas what I am missing here?

  • 1
    Are you running the rsync command as root, or some ordinary (non-privileged) account? (If you're using sudo rsync... then it's still considered as root.) – roaima Sep 9 '17 at 13:39
  • 1
    Which directories have you confirmed you can write to? Can you mkdir /mnt/nfs/synology/websites/test.co.uk as exactly the same account from which you're running your rsync command? – roaima Sep 9 '17 at 13:48
  • 1
    the directory /mnt/nfs/synology/websites doesn't actually exist. The directory at the moment is just /mnt/nfs/synology I wanted rsync to copy the websites folder from ~/resilio-sync/websites to /mnt/nfs/synology so the nfs directory would then be /mnt/nfs/synology/websites. Sorry if i sound confusing. I have tried doing a simple rsync over ssh to my synology nas and that seemed to work just fine. – Mason Sep 9 '17 at 15:45
  • 1
    Here you go [liam@sync-server ~]$ ls -ld ~/resilio-sync/websites drwxrwxr-x. 4 liam liam 42 Aug 30 12:11 /home/liam/resilio-sync/websites [liam@sync-server ~]$ mkdir /mnt/nfs/synology/websites – Mason Sep 9 '17 at 17:08
  • 1
    Here you go [liam@sync-server ~]$ ls -ld /mnt/nfs/synology/websites d---------. 2 liam liam 4096 Sep 9 18:07 /mnt/nfs/synology/websites [liam@sync-server ~]$ One thing i notice here is that it only has 'd' in the permission field? – Mason Sep 9 '17 at 17:24

The error output is telling you that you cannot write to the directory /mnt/nfs/synology/websites (i.e. you cannot create directories - and possibly even files - within it).

The dry run worked because it didn't actually attempt to transfer the files, and so it didn't encounter the permission problem.

If you're using sudo rsync... you will (almost certainly) find that sudo mkdir /mnt/nfs/synology/websites/test.co.uk also fails.

Incidentally, you'll get a far more efficient transfer if you enable the rsync service on the Synology NAS, and use that instead of transferring across NFS.

For starters, be aware that because you're using rsync to copy from one part of the local host's filesystem to another part of what looks like the local host's filesystem, it will not use its differential algorithm to transfer only changes to files' contents. Instead, it will look at file size and modification time and if they differ it will copy the file in its entirety.

Enabling the Synology NAS rsync service (or rsync over ssh if you can) will allow the tool to run in client-server mode, where it can check and transfer only changes to files.

  • thanks for the in depth answer much appreciated. I will take a look at the rsync service on the synology like you mention. I was just suprised that rsync is saying it cant write to the directory /mnt/nfs/synology/websites when I can create in this directory just fine when im not trying to run the rsync command. Would mounting the nfs share in my home directory make any difference? – Mason Sep 9 '17 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.