A long time ago an old friend showed me a way to use an octal or hex umask with a group I think using /etc/profile. I'm not sure.

I'm trying to create group on Debian so that every member of that group when creating a file will produce a file with default permissions 665. And when creating a directory it will have default permissions 775. What are some ways to do this for a group setting?


  • thanks hesse for those edits...i will remember for future edits – maztaz Jan 13 '12 at 19:25
  • So basically, you want to automatically set a umask of 002 for all members of a certain group? I might go dig around in PAM, e.g. adding a pam_umask invocation to common-session or something similar. – jw013 Jan 13 '12 at 20:44
  • @jw013 wow, I think that's close to exactly what he did. in /etc/profile the last line created a umask of 002. – maztaz Jan 14 '12 at 4:39
  • In case you aren't aware of it, you can do default umask overrides on a per directory basis with acl. See eg unix.stackexchange.com/questions/12842/… – Faheem Mitha Jan 14 '12 at 15:04

Not really umask aka (user mask) is set by user. You can add to /etc/profile script that will check for the users of that group and will change their Umask accordingly but as far as I know there is no gmask setting to be applied.


There is no group mask for the dir and files as said by karslon. Instead, you can use the group-id

SGID or setgid: It inherits rights of the group of the owner of the file on execution. For directories it also may mean that when a new file is created in the directory it will inherit the group of the directory (and not of the user who created the file).

Numerical Representation of setgid:

Octal Binary   Representation
0   000     setuid, setgid, sticky bits are cleared
1   001     sticky bit is set
2   010     setgid bit is set
3   011     setgid and sticky bits are set
4   100     setuid bit is set
5   101     setuid and sticky bits are set
6   110     setuid and setgid bits are set
7   111     setuid, setgid, sticky bits are set

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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