I'm having trouble transferring files via ssh from a Windows box to an Ubuntu box using rsync and cygwin on Windows. The file transfer starts, but the newly created directories and files on the server side always get created without user permissions. Thus, any further attempt to write into a directory or subdirectory returns one of numerous "Permission denied (13)" errors from rsync. What's the correct syntax I should use? Do I need to have a more explicit rsyncd.conf file?

On the Windows side, I'm issuing this command:

Patrick@ELWAH P:\Music
> rsync -avz --progress -h ./iTunes patrick@192.168.1.6:/mnt/largemarge

On the server side, it's creating directories with permissions as follows:

patrick@Ceres:/mnt/largemarge$ ll
total 12
drwxr-xr-x 3 patrick patrick 4096 Jul  1 22:16 ./
drwxr-xr-x 3 root    root    4096 Jul  1 20:23 ../
d---rwx--- 5 patrick patrick 4096 Jul  1 21:52 iTunes/
patrick@Ceres:/mnt/largemarge$

And the output from Windows eventually produces errors such as:

Patrick@ELWAH P:\Music
> rsync -avz --progress -h ./iTunes patrick@192.168.1.6:/mnt/largemarge
patrick@192.168.1.6's password:
sending incremental file list
rsync: recv_generator: mkdir "/mnt/largemarge/iTunes/Album Artwork/Cache" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
iTunes/Album Artwork/
iTunes/Album Artwork/Cache/
rsync: recv_generator: mkdir "/mnt/largemarge/iTunes/Album Artwork/Cloud Purchases" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
iTunes/Album Artwork/Cloud Purchases/
rsync: recv_generator: mkdir "/mnt/largemarge/iTunes/Album Artwork/Download" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
iTunes/Album Artwork/Download/
rsync: recv_generator: mkdir "/mnt/largemarge/iTunes/Album Artwork/Remote" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
rsync: recv_generator: mkdir "/mnt/largemarge/iTunes/Previous iTunes Libraries" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
rsync: recv_generator: mkdir "/mnt/largemarge/iTunes/iTunes Media" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
iTunes/Album Artwork/Remote/
iTunes/Previous iTunes Libraries/
iTunes/iTunes Media/

sent 2.10M bytes  received 13.33K bytes  103.31K bytes/sec
total size is 332.36G  speedup is 156,927.14
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1165) [sender=3.1.1]
  • Please add the output of ls -ld iTunes to understand as cygwin which are the permission on the windows side – Hastur Jul 2 '15 at 6:00
up vote 0 down vote accepted

rsync's -a option is actually an alias for (according to the manpage) -rlptgoD. The -p in that list is for "preserve permissions"; i.e., rsync will do stat() on the source file and copy the permission bits to the destination file.

Since windows doesn't have any unix permissions, cygwin has to come up with an approximation, which necessarily is somewhat limited. If you just don't ask rsync to copy the permissions, it will create files and directories with default permission bits, and the problem shouldn't exist.

Note that -g and -o stand for "preserve group" and "preserve owner", respectively, which you might want to exclude as well, for similar reasons.

Your entire command therefore becomes:

rsync -rltvzD --progress -h <source> <destination>

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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