What is "umask" and how does it work?

Posted by Lekensteyn on Ask Ubuntu See other posts from Ask Ubuntu or by Lekensteyn
Published on 2011-05-22T20:42:56Z Indexed on 2011/06/23 16:31 UTC
Read the original article Hit count: 368

Filed under:
|

I believe that umask is something that controls file permissions, but do not fully understand it.

After running umask 0644 in a terminal, I cannot read the files I create with the command-line text editor nano. I noticed that the permissions of that file are set to 0022 instead of the default 0755.

How does umask work? I thought I could just remove the each digit in the umask from 0777, 7 - 6 = 1 and 7 - 4 = 3, so I expect the permissions to be 0133, but apparently, this is not the case.

  1. What is umask exactly? Explain it to me like I was a "Linux noob"
  2. How do I calculate with umask?
  3. What are use cases for umask?

© Ask Ubuntu or respective owner

Related posts about permissions

Related posts about umask