2

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

$ umask
0022
$ umask -S
u=rwx,g=rx,o=rx

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?

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

3 Answers 3

1

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
user::rwx
group::rwx
other::r-x
0

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

0

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.

1
  • 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
    Commented Dec 12, 2012 at 6:22

You must log in to answer this question.

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