I'm trying to push changes to my server through ssh on windows (cygwin) using rsync
. The command I am using is:
rsync -rvz -e ssh /cygdrive/c/myfolder/ [email protected]:/srv/www/prj112/myfolder/
/srv/www/prj112/myfolder/
is owned by rsyncuser
. My problem is that eventhough with rsync
the sub directories are create as they publish, each directory is assigned default permission of d---------
so rsync
fails to copy any files inside it.
How do I fix this?
'rsync -a' option preserves the permissions, ownership, timestamp of files and folders that are to be transferred using rsync. This will synchronize the two folders or files and will also maintain the same timestamp as that of the source.
As a handy command in Linux, Rsync is possible to be used in Windows 10, but the process is complicated and time-consuming. To back up and sync files locally and remotely, you could also use AOMEI Backupper in Windows 10 as a Rsync alternative.
Show activity on this post. Unzip all files to c:\rsync for example, then add c:\rsync to your path. You can also write a windows 1-line rsync. bat “stub” (a command that purely fowards to that rsync folder with the .exe and accompaigning dll's) like so: C:\depot\script\rsync\rsync.exe %* .
The -a option enables archive mode. In archive mode, rsync preserves all file permissions, ownership, and modification times. The -e option specifies the remote shell to use. This is often set to ssh.
The option to ignore NTFS permissions has changed in Cygwin version 1.7. This might be what's causing the problem.
Try adding the 'noacl' flag to your Cygwin mounts in C:\cygwin\etc\fstab, for example:
none /cygdrive cygdrive user,noacl,posix=0 0 0
You can pass custom permissions via rsync using the 'chmod' option:
rsync -rvz --chmod=ugo=rwX -e ssh source destination
Your problem stems from the fact that the Unix permissions on that directory really are 0. All of the access information is stored in separate ACLs, which rsync does not copy. Thus, it sets the permissions on the remote copy to 0, and, obviously, is unable to write to that directory afterwards. You can run
chmod -R 775
on that directory, which should fix your rsync problem.
After a look at the manpage I can tell that the chmod param is available in rsync since version ~2.6.8. But you have to use --chmod=ugo=rwX
in combination with rsync -av
You should also try this command:
rsync -av <SOURCE_DIR> [email protected]:/srv/www/prj112/myfolder
It would work on Linux at least. And note that rsync does not need to mention ssh--at least on Linux.
But if all fails and just to give an option you may take a look at this ready packed-up tool cwRsync
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With