Umask Calculator
Calculate default creation permissions for files and directories based on your Unix umask mask value.
How umask Works
In Linux and Unix operating systems, the umask (user file-creation mode mask) controls the default permissions automatically assigned to newly created files and directories. Rather than granting permissions, umask specifies which permission bits should be masked out (stripped away) at the moment of creation.
The operating system begins with standard starting baselines:
- Base Directory Mode (0777): Read, write, and execute for all (
rwxrwxrwx). Directories require execute permissions so users can enter (cd) and traverse them. - Base File Mode (0666): Read and write for all, with no execute bits (
rw-rw-rw-). Files are created non-executable by default for security.
Common umask Values
| Umask | New Directory Mode | New File Mode | Security Level & Intended Environment |
|---|---|---|---|
022 |
755 (rwxr-xr-x) | 644 (rw-r--r--) | Standard default across most Linux distributions. Owner edits, others read. |
002 |
775 (rwxrwxr-x) | 664 (rw-rw-r--) | Collaborative team setups (User Private Groups). Group members can edit. |
027 |
750 (rwxr-x---) | 640 (rw-r-----) | Hardened production servers. Completely blocks external unprivileged users. |
077 |
700 (rwx------) | 600 (rw-------) | Completely private. Only the file owner has access to created assets. |
007 |
770 (rwxrwx---) | 660 (rw-rw----) | Strict team collaboration where the outside world has zero access. |
How to Set umask
You can check your active umask in any terminal by typing umask. To test a new umask in your current session, run:
# Set umask to 027 for hardened security
umask 027
# Verify the change
umask
# Output: 0027
To make this setting permanent for your user account, add umask 027 to the bottom of your ~/.bashrc or ~/.profile file. In systemd service unit files, define the directive under the [Service] block:
[Service]
UMask=0027
ExecStart=/usr/bin/python3 /opt/app/server.py
Frequently Asked Questions
What does umask 022 mean?
A umask of 022 subtracts write permissions from group members and others. When new files are created (base 666), they receive chmod 644 (rw-r--r--). When new directories are created (base 777), they receive chmod 755 (rwxr-xr-x).
How is umask calculated mathematically?
Umask uses bitwise NOT and AND operations: Directory mode = 0777 & ~umask, and File mode = 0666 & ~umask. For simple umasks, you can think of it as subtracting the umask digits from the base permission.
How do I make my umask permanent?
To make your umask persistent across terminal logins, add the command "umask 027" to your shell profile (~/.bashrc or ~/.profile). For systemd services, configure the "UMask=0027" directive inside the service unit file.
Related Permissions & Tools
Explore detailed guides for permissions commonly produced by umask: