I am studying for my RHCSA. Currently learning about UMASK.

The issue is that my umask is set to 0002, and I am logged in as a normal user, not root. When I create a dir, its correct, the dir gets 775, but when I create a file in /home/user, its gets 662, when it should get 664.

[johnconner@linux-vm ~]$ umask
[johnconner@linux-vm ~]$ ll
drwxrwxr-x. 2 johnconner johnconner 19 May 20 23:23 dir
-rw-rw--w-. 1 johnconner johnconner  0 May 21 12:51 file1

What am I missing?

EDIT: I created another test file in /tmp, and it has 664. This tells me the /home/user dir is different. I cant seem to find a command to view a umask set on a specific dir. I am guessing that is what is happening here.

  • Does getfacl report anything for the file and for the parent directory? – user1686 May 21 '20 at 14:52

well, after navigating to /tmp, I went back to /home/user and removed all files, then used Touch to create a new file, and it has 664 - im at a loss, since this is EXACTLY what I did the first time, but alas, its..working.


John, I cannot comment yet, and this is no answer. But did you realize that touch creates a new file if it is not there and changes the time stamp if it is there? It might be the case the file did exist at the moment you changed the umask, with the permissions corresponding to the old umask. Then, touch leaves the permissions as they are. Might be an explanation of what you saw.

  • Thanks for the response; however, I didnt change the umask. The original (unedited) post made it look like I did, but, I just ran the umask command, which returned the current umask, 0002 - which is the default. So when I created the first file, it shouldnt have been 662. – John Conner May 22 '20 at 18:17

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.