Sharing Knowledge | System Admin Articles

What is umask?




umask will be used for setting the default file creation permissions.When a file is created, its permissions are set by default, depending on the umask setting configured.

This value is usually set for all users in /etc/profile and can be obtained by typing command umask:
testuser$ umask
0022

The default umask value is usually 022. It is an octal number which indicates what rights will be removed by default to all newly created files by a user.For example, 022 indicates that write permissions will not be given to group and other.


For example, with umask value of 000, files get mode 666 and directories get mode 777. As a result, with a default umask value of 022, newly created files get a default mode 644 (666 - 022 = 644) and directories get a default mode 755 (777 - 022 = 755).

To change the umask value:

For example, if you want by default all the,

  • New directories to get permissions rwxr-x----  (Mode: 750)
  • New files to get permissions rw-r-----  (Mode 640)

You need to use a umask value which removes all rights to other, and write permissions to the group and the value is 027. The command to use to set this:

# umask 027



Labels: Linux, Tips

My Profile PhotoAbout the Author

I'm Parthiban, An UNIX System Admin by Profession. I'm Experienced in Linux/Unix System Administration and Scripting. I have done lot of work on the infrastructure Mgmt side in Linux, UNIX and Windows system administration, Hardware, Storage and Data center. I'm blogging since 2008.
Follow Me On Twitter or On Facebook

1 Comments for "What is umask?"

Excellent and very helpful for anyone.Thanks

What do you think about this Article? Add your Opinion..!

Back To Top