10
2
I want to use rsync to transfer files from my computer to a remote Linux system. Regardless of the local file's group ownership, I want to set these values on the remote side.
If I was on the remote Linux system, I could create the directory and set the ownership and permissions as:
mkdir my_directory
chown :my_group my_directory
chmod 775 my_directory
If I create the directory locally and then use rsync (remember, I don't have my_group locally), I do:
rsync -ae ssh --chmod=ug+rw,Dug+rwx my_directory remoteserver:dest
That works, but I cannot figure out how to set the group owner through rsync. If I do a chmod g+s dest
, my_directory has the correct group owner but all of the files inside have the incorrect group owner.
Hi @ChrisInEdmonton, did you find a way to make this work in the end? I am right now faced with the same issue, I am running cygwin to rsync files from windows to a linux box but cannot set the correct group id of new files being sent through:
rsync -avz --delete --exclude "*.git" --chmod=ug=rwx,o=rx /cygdrive/d/projx/ john@123.123.123.123:/var/prox/
The files land as john:john instead of john:projx (where projx is the name of the group) – John – 2015-02-11T15:59:24.6201I have just found rsync 3.1 includes
--groupmap=*:group-name'
.. right after i posted ha. – John – 2015-02-11T16:04:21.287