Permissions for multiple users


#1

Hi all,

Here’s something that’s been bothering me for a while. We have git repos and client sites hosted on our boxes and I constantly have to set the permissions on directories shared by our team.

For example, I upload a directory and set its permissions to group writable. Another developer creates a directory within this directory - as he’s in the same group, this works fine. However, the permissions on that directory will now be set as group r/x and if I try to write anything to it, it fails.

This may seem like a small issue, but it crops up on a daily basis and I can’t help thinking there’s a better way than manually setting permissions.

Saying that, it does really normally occur when working with git repos - the place we’re adding a files to regularly - so perhaps the answer is to use the git server to access repos instead of over ssh.

Anyway - I’m interested in any thoughts and ideas,

Cheers!

Steve


#2

If you set the sticky bit on the parent directory the permissions should be maintained even for new subdirectories.


#3

The group-sticky bit (g+s, mode 02000) on a directory causes “BSD semantics” to be used which propagates the group ownership and permissions to new subdirectories and files. This is probably what the OP wants, I hope the delayed reply is still useful !

Note however that default umask of 002 turns off the group-writable bit so you may still have to jump through hoops to set umask all over the place.

The user-sticky bit (u+s, mode 01000) on a directory means that files can be deleted by either the file owner and the directory owner, but doesn’t affect file creation permissions.

man 2 stat


#4

You might also want to consider posix ACLs

http://www.suse.de/~agruen/acl/linux-acls/online/

By setting a “default ACL” on a directory you can negate the affects of umask.