Mask that controls which file permissions are set for files and directories when they are created. It also refers to a function that sets the mask, and to the mask itself, which is formally known as the file mode creation mask.
When a user creates a file or a directory under GNU/Linux or another Unix-like operating system, the default set of permissions are set by the umask command.
Set up the default umask
Usually the umask is set in the file:
or for bash shell:
for defining the user's environment at login:
and it set with adding something like in the files:
How is the umask calculated ?
The umask command uses octal values for determining the permissions of the files and directories. The default permissions for a file are calculated by subtracting the value of 666 like:
666 - 022 = 644
This means the file permissions would be (rw-r--r--)
For directories the default permissions are calculated as follows:
777 - 022 = 755
This translates to base directory permissions (drwx-rw-rw-)
For more information on umask type in shell:
$ man umask