Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Use ACL's

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

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
Actually, AFAIU NFS3 & NFS4 do support (some?) ACLs (at least on linux)? – JanC Aug 26 '10 at 23:28
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… Seems you will have to use 'chmod' if setfacl unavailable under bash. – bshea Jan 26 '11 at 23:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .