fir3net
PPS-Firenetbanner-780.5x190-30-03-17

What is a umask ?

The Umask (User Mask) is a UNIX function that is used to control the permission bitmask applied to newly created files and folders.
The Umask value is subtracted from the default permission value. The resulting value is then assigned as the permission bitmask to the newly created file or folder.

Note : The default permission values are 777 for directories and 666 for files.

Example

A umask of 022 is assigned. A file is created. The default permissions for a file is 666. The umask (022) is then subtracted from the default permission value of 666. This results in a permission set of 644 (-rw-r--r--) being assigned.

[root@server tmp]# umask 022
[root@server tmp]# umask
0022
[root@server tmp]#
[root@server tmp]# touch document.txt
[root@server tmp]# ls -l document.txt
-rw-r--r-- 1 root root 0 Jun  5 17:50 document.txt
[root@server tmp]#

About the Author

RDonato

R Donato

Rick Donato is the Founder and Chief Editor of Fir3net.com. He currently works as a Principal Network Security Engineer and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001