Umask Calculator

ReadWriteExecute
Owner:
Group:
Others:

Results:

Numeric Umask: 000

Effective Permissions: rwxrwxrwx

The umask command in Linux is used to set the default permission modes for newly created files and directories. When a new file or directory is created, the system uses the umask value to determine the initial permissions

How umask Works

The umask value is a three-digit octal number that determines which permission bits to turn off when a new file or directory is created. To understand how umask affects the permissions, let’s look at the default permission settings for files and directories:

  • Default file permissions: 666 (read and write for everyone, no execute)
  • Default directory permissions: 777 (read, write, and execute for everyone)

When a new file or directory is created, the umask value is subtracted from these defaults to determine the final permissions. For example, if the umask is set to 022, the permissions for new files and directories would be:

  • Files: 666 – 022 = 644 (read and write for owner, read-only for group and others)
  • Directories: 777 – 022 = 755 (read, write, and execute for owner, read and execute for group and others)

Examples of umask

To make it easier to understand how different umask values affect file and directory permissions, here’s a table with several examples.

umask ValueFile PermissionsDirectory PermissionsDescription
000666777Full permissions for everyone (read, write) for files and (read, write, execute) for directories.
022644755Owner can read and write files, others can only read. Directories are executable by everyone.
027640750Owner can read and write files, group can read, others have no access. Directories are executable by owner and group.
077600700Only owner has read and write permissions for files, and full control for directories.
002664775Owner and group can read and write files, others can only read. Directories are executable by everyone.
0177600700Same as 077 (only owner has full control).

Setting and Viewing umask

To view the current umask value, simply type umask in the terminal:

umask

To set a new umask value, use the umask command followed by the desired value:

umask 027

This command sets the umask to 027, which means new files will have permissions 640 and new directories will have permissions 750.