I have an odd problem with umask. My current setting is:

$ umask
$ umask -S

This only works for files though and not directories:

$ touch abc
$ ll abc
0 -rw-rw-rw- 1 user1 group1 0 Dec 12 11:39 abc
$ mkdir def
$ ll -d def
8.0K drwxrwxrwx+ 2 user1 group1 4.0K Dec 12  2012 def

Can anybody suggest why umask is not working for the directory? Any help is appreciated!

This is a new Centos linux system.

Edit: thanks for the comments. As some have pointed out, this doesn't work for files either.

Extra information: This problem only seems to occur on the home directory which is mounted over NFS, and not on local directories. Could NFS be causing the problem somehow?

  • abc's perm is not right either. it should be -rw-r--r-- – freestyler Dec 12 '12 at 3:05
  • You're right - thanks for pointing that out. – Tetsuo Dec 12 '12 at 6:23
  • Can you repeat these tests in the /tmp directory? – slm Jan 12 '13 at 13:01

I think you're problem is that you have access control list getting applied here as well. Notice the directory, def? It has a trailing '+' which means that there is ACL permissions getting applied here as well. Can you run the command getfacl at your $HOME directory level? This will give us more insight into what's going on.

For example:

% getfacl .
# file: .
# owner: saml
# group: saml
| improve this answer | |

Directories have execution permission unless you disable it explicitly. Try umask 0033 if that's what you want.

| improve this answer | |

The umask is not work at all.

For file, the touch command will create with -rw-rw-rw- and the umask is 0022, then after mask 0666 & ~ 0022. The final permission will be 0644 (-rw-r--r--). So it does not work for file either.

For directory, the mkdir command will create with rwxrwxrwx and the umask is 0022, then after mask 0777 & ~ 0022. The final permission will be 0755 (rwxr-xr-x).

But I do not know why does it not work. Maybe it is the problem of your SHELL.

| improve this answer | |
  • 1
    Thanks for your comment, you're right - the file is not set correctly either. I'm wondering if NFS is the problem (see edit above), but I don't understand the connection to umask in that regard. – Tetsuo Dec 12 '12 at 6:22

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.