setgid on directories

Daniel Clark dclark at
Wed May 5 03:46:46 GMT 2004

Wayne Davison wrote:
> On Wed, Mar 17, 2004 at 10:41:04AM -0500, Jim Ogilvie wrote:
>>I made the following changes to make rsync set the group id bit on new
> There's a patch in the "patches" subdir of the source that adds a
> --chmod option to rsync.  I just improved it a bit so that you can
> specify a mode modification that affects just directories (or just
> files) instead of all files.  If you want to try it out, check out the
> CVS version and apply the very latest chmod-option.diff patch before you
> build it.
> Using this patch, you would accomplish the setting of the sgid bit on
> all directories in this way:
>     --chmod Dg+s
> The 'D' specifies that the g+s only applies to directories.
> ..wayne..

Would you create or accept a patch to the chmod patch that extended the 
--chmod syntax so that you could set user/group/other equivalent to one 
of the other user/group/other bitsets and then optionally apply changes 
to that?

For example, --chmod g+us would make the group bits equivalent to the 
user bits, and then add the setgid bit to that. This syntax isn't well 
thought through, so I'd appreciate any alternative suggestions.

The case where this would be useful would be using rsync from AFS (where 
only the user bits really matter, so others are often ignored) to other 
file systems, esp. those with ACLs like DFS (I think) and GSA [1] where 
the group bits act as a mask to the ACL, so that if the group bits are 
set restrictively no one but the user will be able to access the file.

[1] IBM Global Storage Architecture

More information about the rsync mailing list