5

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

maztaz
  • 151
  • 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 04:39
  • In case you aren't aware of it, you can do default umask overrides on a per directory basis with acl. See eg http://unix.stackexchange.com/questions/12842/permission-of-saved-files – Faheem Mitha Jan 14 '12 at 15:04

2 Answers2

1

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.

Karlson
  • 5,875
1

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
Mughil
  • 1,973