I have a fairly restrictive umask setting (0077). This is fine, except I have one directory in which I'd like a more permissive setting (0002) to all files created anywhere under that directory. Is there a way to set a umask on a specific directory, so all files created beneath it inherit the same permissions?

link|improve this question

50% accept rate
feedback

1 Answer

Use ACL's

setfacl -d -m mask:002 /your/dir/here/

http://man-wiki.net/index.php/1:setfacl

If wanting to have a default for a login, just add a "umask 002" to your .bashrc (or whatever shell you use). All new dirs will use this if logged in under that env.

link|improve this answer
Just a heads up: ACL's don't translate across a network. (Samba/NFS)... You will need to add to that to the individual network config file insead for the specific dir. (i.e. smb.conf - create mask = 775) – bshea Aug 26 '10 at 22:44
1  
Actually, AFAIU NFS3 & NFS4 do support (some?) ACLs (at least on linux)? – JanC Aug 26 '10 at 23:28
1  
And so does Samba... – JanC Aug 26 '10 at 23:31
Haven't had to try that in long, long time. Better safe than sorry (!) Good to know. Thanks. – bshea Aug 26 '10 at 23:38
This is for Mac OS X. – mipadi Aug 27 '10 at 1:34
show 1 more comment
feedback

Your Answer

 
or
required, but never shown

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