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]# touch document.txt
[root@server tmp]# ls -l document.txt
-rw-r–r– 1 root root 0 Jun 5 17:50 document.txt
- How to Configure a BIND Server on Ubuntu - March 15, 2018
- What is a BGP Confederation? - March 6, 2018
- Cisco – What is BGP ORF (Outbound Route Filtering)? - March 5, 2018
Want to become a Linux expert?
Here is our hand-picked selection of the best courses you can find online:
Linux Mastery course
Linux Administration Bootcamp
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial