Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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@ The files land as john:john instead of john:projx (where projx is the name of the group) – John Feb 11 '15 at 15:59
I have just found rsync 3.1 includes --groupmap=*:group-name'.. right after i posted ha. – John Feb 11 '15 at 16:04
up vote 6 down vote accepted

Right this minute, I'm looking for a way to do this in the rsync operation myself, as oppose to in a subsequent operation. I want some files not to be world readable and assign a group, thereby restricting access to the remote server processes within that group. But I haven't found one.

The only thing I can imagine is to:

  1. use --delay-updates to make putting the remote files in a more atomic, instantaneous operation assign
  2. g+rwx,o+rwx in the rsync --chmod option

and then run:

ssh remoteserver chgrp -R {groupname} /my/dest/folder/* && \
chmod -R o-rwx /my/dest/folder/*
share|improve this answer
Yeah, I think that's what we are going to do. I'm surprised there's no way that you or I could find to do this just with rsync, but hey. – ChrisInEdmonton Mar 17 '10 at 14:55

I think the -p flag is missing from your command ..


This option tells rsync to apply one or more comma-separated "chmod" strings to the permission of the files in the transfer. The resulting value is treated as though it was the permissions that the sending side supplied for the file, which means that this option can seem to have no effect on existing files if --perms is not enabled.

share|improve this answer
The -p flag is implicitly included as part of the -a (archive) option. – Anthony Geoghegan Mar 23 at 14:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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