Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Where do the default values of 666 and 777, for files and directories respectively, get stored?

umask 0002
touch dummy 
ls -l 

Tells me that dummy's permissions are 700 as opposed to the expected 644. Any ideas?

share|improve this question

migrated from Sep 25 '12 at 4:29

This question came from our site for professional and enthusiast programmers.

It doesn't seem like umask is doing anything. Even after setting umask to 100, and then making a temp file, I still get 700 as my permissions. – aafc Sep 24 '12 at 20:52
What kind of file system is this? If it's a FAT/vFAT filesystem that doesn't understand the full set of permissions, then the actual results you get will depend more on mount options than on umask. – twalberg Sep 24 '12 at 21:17
FWIW, mktemp, the real "make temporary file" command, will only give permissions to owner. – Daniel Beck Sep 25 '12 at 4:59

[max@localhost ~]$ umask

This will display default umask


In /etc/bashrc file default permissions are stored

 16 if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
 17     umask 002
 18 else
 19     umask 022
 20 fi

The default umask for normal user 002

The default umask for the root user is 022

For directories, the base permissions is 0777 and for files 0666

That means if you set umask value to 002 then you subtract the umask from the base permissions

For Directories


For files


[max@localhost ~]$ mkdir file1

[max@localhost ~]$ ls -ld file1

drwxrwxr-x 2 max max 4096 Sep 25 15:37 file1 ------>775

[max@localhost ~]$ touch file2

[max@localhost ~]$ ls -l file2

-rw-rw-r-- 1 max max 0 Sep 25 15:40 file2------->664

share|improve this answer

You must log in to answer this question.