Today I took LPIC 101-500 exam and I passed but one question keeps bothering me. The question was:

Given the following permissions -rw-r----- what umask should be applied to make all files have the same permissions? My reasoning is as follows (please correct me if I'm wrong):

- indicates that this is a regular file
r - 4
w - 2
- - 0
r - 4
- - 0
- - 0
- - 0
- - 0
- - 0

which gives 640 permissions.

Now, I know that umask is essentially an inverse of permissions so this comes down to the following equation:


So my answer would be 137, however there was no answer that included this result and I probably got this answer wrong. What am I missing?

  • You can test it easily enough...% umask 137 ; touch xx ; ls -l xx gets the result -rw-r----- 1 sweh sweh 0 Mar 16 18:45 xx Mar 16, 2022 at 22:46
  • Yes, I know. I think you misunderstood my problem. This result was not a possible answer among all answers to be selected.
    – jedi
    Mar 16, 2022 at 23:00
  • I now found out that there is a distinction between default mask for directories and default mask for regular files. Default mask for directories is 777 and for files 666 so my reasoning was wrong and the correct answer was 0026
    – jedi
    Mar 16, 2022 at 23:03
  • Not really; when an application (eg touch or shell >) creates a file it specifies a mode. Typically that's 0666. However an application such as gcc will create the final executable with 0777 (because we normally want x set). That mode is "AND !umask" which results in the permissions. Similarly directory creation is passed a mask; normally that's 0777 but it doesn't have to be. It's purely up to the program that's doing the creation. So if I wrote a program that did mkdir("xyzzy",0700) or open("foo",O_RDWR|O_CREAT,0700) then the permissions would be rwx------ (before umask). Mar 16, 2022 at 23:49
  • 1
    The umask isn't an inverse of permissions or as some other would put it, a value via subtraction. It's a mask. What each number is doing is masking one or more of the bits. The default umask for most systems is 022 and that gives directories 755 permissions and files 644 permissions (same as directories w/o execute bit). Your answer of 137 is correct but rather than thinking of it as coming via subtraction, think of it as what it's actually doing which is masking the execute bit for the owner, the write and execute bits for the group, and read, write, and execute for everyone else. Mar 16, 2022 at 23:58

1 Answer 1


Since the answer 137 was not available in any of the possible answers I missed the fact (which I have now learned) that the default mask for regular files is 666, so 6666 - 6640 = 0026 and as far as I remember correctly, this was one of the possible answers.

You must log in to answer this question.

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