If we create a shared directory, and allow say a root user and a group sharedgroup to the permissions: -rwxrwxr--, and we want every new file to have the permissions -rwxrwxr--, but the permission of the parent directory to be rwxrwxr-w. The way to do this would(what I know) be to set the default umask to 0003, but it appears once we close the terminal the umask is reset. So how do we make the change permanent only for a directory, because we wouldn't want to change the umasks of the entire system.

  • How are users accessing this directory? SSH into hte machine? or via a network share? – ivanivan Sep 26 '17 at 2:10
  • It's basically a machine, that multiple users will be logged in, like a cyber cafe where the users are given a seperate account – mathmaniage Sep 26 '17 at 4:57
  • r-w for a directory makes little sense. You can't write to a directory if you don't have search permission as you need search permissions to anything with files in the directory. Giving execute permission to every non-directory file also makes little sense. Only files meant to be executed should have that permission. – Stéphane Chazelas Sep 26 '17 at 7:09

You cannot customize umask on a per-directory basis.

The typical way to solve your particular scenario, is to use a setfacl default mask.

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.