Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

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.

share|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
1  
serverfault.com/questions/6607/… Seems you will have to use 'chmod' if setfacl unavailable under bash. –  bshea Jan 26 '11 at 23:34
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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