Rsync on Windows: Incorrect permissions for created directories

I am trying to push changes to my server via ssh on windows (cygwin) using rsync . The command I use is:

rsync -rvz -e ssh/cygdrive/c/myfolder/rsyncuser@192.168.1.110: / srv / www / prj112 / myfolder /

/srv/www/prj112/myfolder/ owned by rsyncuser . My problem is that eventhough with rsync creates subdirectories when they are published, each directory is assigned the default permission d--------- , so rsync cannot copy any files inside it.

How to fix it?

+45
windows rsync
Apr 27 2018-11-11T00:
source share
6 answers

The ability to ignore NTFS permissions has changed in Cygwin 1.7. This may be 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 user permissions through rsync using the "chmod" option:

 rsync -rvz --chmod=ugo=rwX -e ssh source destination 
+65
May 6 '11 at 13:12
source share

Your problem is that the Unix permissions in this directory are indeed 0. All access information is stored in separate ACLs that rsync does not copy. Thus, it sets the permissions for the remote copy to 0 and, obviously, cannot subsequently write to this directory. You can run

 chmod -R 775 

in this directory, which should fix your problem with rsync.

After viewing the man page, I can say that the chmod parameter has been available in rsync since ~ 2.6.8. But you should use --chmod=ugo=rwX in combination with rsync -av

You should also try this command:

 rsync -av <SOURCE_DIR> rsyncuser@192.168.1.110:/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 else fails and just give an option, you can take a look at this ready-made packaged cwRsync tool

+7
May 12 '11 at 8:39
source share

if you deploy a site from windows (for example, to use octopress rsync), it can set the resolution to 775 by adding a few chmod commands:

  rsync -avz --chmod=ug=rwx --chmod=o=rx -e ssh 
+7
Sep 18 '12 at 23:13
source share

To run rsync from Windows on Unix / Linux, you must provide a command like

 SET BACKUP_SERVER=my.backup.server SET SSH_USER=theUnixUserName SET STORAGEPATH=/home/%SSH_USER%/Backup/ SET STORAGEURI=%BACKUP_SERVER%:%STORAGEPATH% SET SSH_ID=/cygdrive/c/Users/theWindowsUserName/Documents/keyfiles/id_dsa SET EXCLUDEFILE=backup_excludes.txt SET BACKUPLOGFILE=/cygdrive/c/Users/theWindowsUserName/Backuplogs/backup-%DATE%-%TIME::=-%.log 

Then ssh command

 SET BACKUP=rsync -azvu --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r --rsh="ssh -l %SSH_USER% -i '%SSH_ID%'" --exclude-from=%EXCLUDEFILE% --delete --delete-excluded --log-file="%BACKUPLOGFILE%" 

with backup_excludes.txt containing strings of ignored items, e.g.

 .git .svn .o \Debug \Release 

Then you would use this in a script with

 %BACKUP% /cygdrive/c/mySensibleData %STORAGEURI% %BACKUP% /cygdrive/c/myOtherSensibleData %STORAGEURI% %BACKUP% /cygdrive/c/myOtherSensibleData2 %STORAGEURI% 

etc. This will back up your directories mySensibleData strong>, myOtherSensibleData strong> and myOtherSensibleData2 with permissions of 755 for directories and 644 for files. You also get backup logs at % BACKUPLOGFILE% for each backup.

+2
Aug 15 '13 at 14:25
source share

Cygwin rsync will report a permission to refuse when any process opens the target file. Download and run Process Explorer and find out if anything else is blocking, or just try renaming the file and see if you have a Windows error regarding another process in which the file is open.

+1
Feb 26 '13 at 11:53
source share

Alternatively, you can try to create a (global) CYGWIN environment variable and set its value to nontsec

0
Jul 23 '13 at 18:26
source share



All Articles