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.


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
[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]#