$linuxjunkies
>

umask

also: file creation mask

A shell setting that specifies which permission bits to remove when creating new files and directories, acting as a default restriction on file permissions.

umask (user file creation mask) defines the default permissions for newly created files and directories by specifying which bits to subtract from the standard permission set. When you create a file, the system starts with 666 (rw- rw- rw-) and subtracts the umask; for directories, it starts with 777 (rwx rwx rwx).

For example, a umask of 0022 removes write permission for group and others: 666 - 022 = 644 for files (rw- r-- r--) and 777 - 022 = 755 for directories (rwx r-x r-x). This is the common default on many systems.

You can view your current umask by typing umask with no arguments, and change it with umask 0027 (for example). Settings in ~/.bashrc or /etc/profile make the change persistent across sessions.

Related terms