How to set umask for a folder and it's subfolder?
I assume that you did already:
chmod g+rwxs directory
and now you have to make sure that the users have a umask like 002. To setup the umask for all the users, try in /etc/bashrc or /etc/profile.
caveat: you cannot setup a umask per directory as it's a process level thing.
Interesting read http://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html
Related videos on Youtube

Cyril N.
Updated on September 18, 2022Comments
-
Cyril N. 3 months
I'm working on the same directory with some friends and they access it via SSH.
I added us in the same group and defined a sticky bit to keep the user:group values the same.
But when a user create a file/folder, the Write attribute is not defined for the group, disabling other to write it/on it.
How can I define the Umask to add the Write value for groups in the specific directory and it's subfolders ?
I tried to find some help before, but I only saw helps for Fedora/CentOs, and I'm using Debian Squeeze.
Thanks for your help
-
Cyril N. over 9 yearsThanks for this help. Does it works when using ssh over git ?
-
zekus over 9 yearstbh I am not sure but, because you are using a unix user anyway even with git, in theory it should work.
-
Ryu_hayabusa almost 8 yearsumask 002 ~ chomd 775
-
bricklore about 7 yearsYou actually can set a umask per directory using Linux ACLs, e.g. use
setfacl -R -m group:groupname:rw-,d:group:groupname:rw- directory/
to force the r and w permission for the group "groupname" on a directory