Rynsc on Windows 7 Under Cygwin

I *finally* have rysnc working under Windows 7 without issuing permission-denied messages. Here’s the story:

The goal is to run a bash script that backs up a set of directories to a an external hard-drive. This script will run as me from a bash shell.

The destination hard drive is mounted as E: in this example. The bash script contains a series of rysnc commands similar to:

rsync -rltgovR --delete-after /cygdrive/h/music /cygdrive/e

This will mirror h:\music on E:\h\music with recursion.

The catch was getting permissions correct on the external drive. This took two commands run from a cmd.exe shell (bash shell should work if you escape the parameters correctly, but don’t bother for two commands).

E: is rsync destination for mirrors, ‘Kevin’ is the windows user name the script will be running under.


E:
cd \
takeown /f * /r /d y
icacls * /grant Kevin:(F) /T

This did it for me. Hope this helps.

Some other posts mention adding
none /cygdrive cygdrive binary,posix=0,user,noacl 0 0
to /etc/fstab. I tried this both ways and it did not seem to matter. For now it is commented out.

This entry was posted in programming. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>