What is UMASK and use of UMASK & how it works in Linux ?
In Linux world, the command umask (User Mask or User file creation MASK or Mode) is the default permission assigned to new files/folders when created in Linux. Most of the Linux distributions gives 0022 as default UMASK for newly created files or directories.
Umask contains a four-digit octal number and can be set or expressed using:
Symbolic values Octal valuesYou can find out your default umask by using command:
$ umask 0022Also you can set or change default umask for all new users as shown below.
$ umask 027For more usage read **man pages** of umask
is umask value and mask value are same(identical) terms ?
Both are same, actually the command umask determines the settings of a mask that manages file permissions of a newly created files/folders, it also known as file mode creation mask.
The mask meant for a grouping of bits, each of which defines how its corresponding permission are set for newly created files. The bits in the mask may be modified or changes by running the umask command.
The two most common directory umasks are 002 (the default) and 022.
002- Assigns permissions so that only you have read/write access for files, and read/write/search for directories you own. All others have read access only to your files, and read/search access to your directories
022 - Assigns permissions so that you and members of the file/folders group have read/write access to files, and read/write/search access to directories you own. All others have read access only to your files, and read/search to your directories.
022 is helpful if, for example, you have many users on a computer that are web designers, you can by default, make your primary group www-data, and by default all new files and folders can also be worked on by others in the www-data webserver group. The drawback, you will need to manually override that for your music folders and personal folders you do not want to share.