Umask Calculator with Effective Permissions Preview

<p>A Linux tool for calculating umask values and previewing their effect on file and directory permissions</p>

Umask Calculator

Umask Permission Bits

umask
Read
Write
Execute
User
Group
Others

Checked boxes represent bits that are BLOCKED in new files/directories.

Current Umask Value
022
Command: umask 022

Effective Permissions Preview

File Creation (Default: 666)

Default Permission
666
rw-rw-rw-
-
022
=
Effective Permission
644
rw-r--r--

Directory Creation (Default: 777)

Default Permission
777
rwxrwxrwx
-
022
=
Effective Permission
755
rwxr-xr-x

Common Umask Values

022
Standard for most Linux distros
Files: 644 (rw-r--r--)
Dirs: 755 (rwxr-xr-x)
002
Collaborative environments
Files: 664 (rw-rw-r--)
Dirs: 775 (rwxrwxr-x)
077
Private - owner only
Files: 600 (rw-------)
Dirs: 700 (rwx------)
027
Group collaboration, restricted others
Files: 640 (rw-r-----)
Dirs: 750 (rwxr-x---)

What is umask?

umask (user mask) is a command in Linux/Unix systems that sets the default permissions for newly created files and directories. It works by "masking out" (removing) certain permission bits from the default permissions.

How Umask Works

When you create a new file or directory, the system starts with default permissions (typically 666 for files and 777 for directories), then subtracts the umask value:

For Files:

666 - umask = effective permissions

Default file permissions (666) minus your umask value gives the actual permissions for new files

For Directories:

777 - umask = effective permissions

Default directory permissions (777) minus your umask value gives the actual permissions for new directories

Understanding Umask Values

Umask uses the same octal notation as chmod, but with opposite meaning:

  • 1 blocks execute (x)
  • 2 blocks write (w)
  • 4 blocks read (r)

For example, umask 022 means "block write and execute for group and others, but don't block anything for owner".

Checking Current Umask

To check your current umask setting:

$ umask
0022

The leading 0 is sometimes shown but can be omitted when setting the umask.

Common Umask Settings

UmaskFile PermissionsDirectory PermissionsDescription
022644 (rw-r--r--)755 (rwxr-xr-x)Default on most Linux systems, good balance of security
002664 (rw-rw-r--)775 (rwxrwxr-x)Good for collaborative environments where group members need write access
077600 (rw-------)700 (rwx------)Maximum privacy, files accessible only by the owner
027640 (rw-r-----)750 (rwxr-x---)Group can read/execute but not write, others have no permissions
007660 (rw-rw----)770 (rwxrwx---)Owner and group have full access, others have none

Setting Your Umask

Temporary Change

To set umask for your current session only:

$ umask 022

Permanent Change

To make your umask change permanent, add it to your shell's startup file:

For Bash:

# Add to ~/.bashrc
umask 022

For Zsh:

# Add to ~/.zshrc
umask 022

Tips & Best Practices

  • The standard umask on most Linux systems is 022, which is a good balance between security and usability
  • For sensitive data, consider using a more restrictive umask like 077
  • On shared systems where collaboration is important, 002 might be appropriate
  • Remember that the umask only affects newly created files, not existing ones
  • When setting up web servers, the umask may need to be adjusted based on which user runs the web server process

Stay Updated with Linux Tips

Get weekly tutorials, command references, and new tool announcements delivered straight to your inbox.