Skip to content

Writable, shared directory structure under Unix/Linux

Sometimes you need to make some directories available (R/W mode) to a group of developers on a Linux / Unix server. Using shell tools make this task very easy.

First, ensure all files group are switched to desired group:

find . ! -group group1 -exec chgrp group1 '{}' \;

Then +s (sticky) bit must be attached to directories to ensure group will be preserved in newly created directories:

find . -type d ! -perm -g=s -exec chmod g+s '{}' \;

Then writeability for the group should be set:

find . -type d ! -perm -g=w -exec chmod g+w '{}' \;

And finally some users must be added to the group:

adduser user1 group1

Additionally you have to set default umask to 0002 (only o+w filtered out). It's done by installing libpam-umask and adding to /etc/pam.d/common-session:

session    optional     pam_umask.so umask=002

That's all.