Developer Tools guide
Umask Calculator Guide
This page holds the detailed reference that supports the focused interactive tool.
Open the Umask CalculatorWhat is umask?
Umask is a Linux and Unix permission mask that decides which permissions are removed when a process creates a new file or directory. It does not change files that already exist. Instead, it sets the default starting point for future output from your shell, service, deploy script, editor, or cron job.
Linux umask calculator for default permissions
Use this Linux umask calculator when you need a fast umask calc, a umask generator for copy-ready permission results, or a way to explain why new files become 644 and new directories become 755. It is useful before configuring deploy users, shared folders, CI output, cron job logs, service accounts, or private local scripts.
How umask works
Umask works by removing permission bits from the normal creation defaults. Regular files normally begin from 666, so they can be readable and writable but not executable. Directories normally begin from 777, because execute permission is required to enter and list a directory path.
How to use this tool
- Enter a three-digit or four-digit umask such as
022or0022, or choose a preset. - Review the resulting file and directory permissions.
- Copy the result into deployment notes, server docs, or a permissions checklist.
Real examples
- Why
umask 022creates files as644: files start from666, then the mask removes group write and other write permission. - Why
umask 022creates directories as755: directories start from777, then the same mask removes write permission for group and others. - Why
umask 002fits shared groups: it keeps group write permission, so new files usually become664and directories become775. - Why
umask 077is private: it removes all group and public permissions, so new files usually become600and directories become700.
Umask vs chmod
Use umask when you want to control defaults for new files and directories. Use chmod when the file or directory already exists and needs a new explicit mode. For example, umask 022 affects future output, while chmod 644 app.log changes the existing app.log file.
Common use cases
- Check default permissions before configuring a deploy user.
- Explain why newly created directories are executable but files are not.
- Document safer defaults for shared servers and CI output folders.
Sample input/output
Input: 022
Output: new files 644 (-rw-r--r--), new directories 755 (drwxr-xr-x).
Common errors and fixes
| Issue | Why it happens | How to fix it |
|---|---|---|
| Files do not become executable | New files normally start from 666, not 777. |
Use chmod +x file after creation when a script needs execute permission. |
| Group cannot write shared files | A common 022 umask removes group write permission. |
Use 002 for trusted shared groups when your server policy allows it. |
| Invalid umask value | Umask digits must be octal, so each digit must be between 0 and 7. | Use values like 022, 027, 077, or 002. |
Edge cases table
| Edge case | Expected behavior |
|---|---|
000 |
New files become 666 and directories become 777, which is usually too open for shared systems. |
077 |
New files become 600 and directories become 700, limiting access to the owner. |
| Four-digit values | This tool focuses on the last three permission digits. Special mode bits should be reviewed with system documentation. |
Common Umask Values for Linux Files and Directories
Use these common values as a starting point for deploy users, shared project folders, generated files, and private service accounts. Always match the setting to your server policy.
| Umask | New files | New directories | Typical use |
|---|---|---|---|
0022 / 022 |
644 / rw-r--r-- |
755 / rwxr-xr-x |
Common default for readable public files and traversable folders. |
0002 / 002 |
664 / rw-rw-r-- |
775 / rwxrwxr-x |
Trusted shared groups that need collaborative write access. |
0027 / 027 |
640 / rw-r----- |
750 / rwxr-x--- |
Team or service directories where public access should be removed. |
0077 / 077 |
600 / rw------- |
700 / rwx------ |
Owner-only files, private service output, and sensitive local notes. |
Umask 0022, 0027, and 0077 explained
These three masks cover most real Linux setups. Each value below shows the exact file and directory result, where it fits, and where it causes problems.
Umask 0022 / 022 — files 644, directories 755
umask 0022 is the most common Linux default. New files start from 666, so removing the group and public write bits produces 644 (rw-r--r--). New directories start from 777 and become 755 (rwxr-xr-x): everyone can read files and enter directories, but only the owner can write.
- Good fit: public-readable files, static website output, default shell sessions.
- Bad fit: secrets, group-write collaboration folders, locked-down service accounts.
- Compare: 0027 removes public access; 0077 removes group access too;
0002instead keeps group write for shared teams.
Umask 0027 / 027 — files 640, directories 750
umask 0027 keeps output private from other users while letting a trusted group read files (640, rw-r-----) and traverse directories (750, rwxr-x---). It removes group write and all public permissions from everything a process creates.
- Good fit: service accounts with a trusted group, team-readable logs, private project directories.
- Bad fit: public web assets, group-write collaboration, single-user output that should be 0077.
- Compare: next to 0022 it removes public access; next to 0077 it still allows group read.
Umask 0077 / 077 — files 600, directories 700
umask 0077 — often written as umask 077, both describe the same mask — is the private-by-default setting. New files become 600 (rw-------) and new directories 700 (rwx------), so only the owner can read, write, or enter them. Files end up 600 rather than 700 because regular files start from 666: umask only removes bits, it never adds execute.
- Good fit: private user files, sensitive service output, owner-only directories such as key stores.
- Bad fit: shared group directories, public static assets — teammates lose access to every newly created file.
- Compare: umask sets defaults for new files; use
chmod 600(see the chmod calculator) to fix existing files.
Verify Umask Results in Linux
After calculating a value, you can verify the result in a shell with a temporary file and directory.
umask 022
touch demo-file
mkdir demo-dir
ls -l demo-file
ls -ld demo-dir
With umask 022, new files usually become 644, and new directories usually become 755. Run umask -S to show the current mask in symbolic form.
When umask is not enough
Umask only controls the default mode for files and directories created after the mask is set. It does not change existing files, switch the owner, add a process to a group, or override ACL rules already attached to a shared folder.
- Existing path has the wrong mode: inspect it with
stat -c "%U %G %a %n" pathand use the chmod calculator for the explicit mode. - Service writes as the wrong user: confirm the process user and groups with
idorid service-user. - Shared folders still fail: inspect inherited rules with
getfacl path, then review setgid directories or default ACLs. - Docker or Syncthing cannot write: follow the Docker PUID/PGID guide or Syncthing shared-folder checklist before widening permissions.
How Umask Permissions Are Calculated
Umask removes permissions from the usual maximum defaults. Regular files usually start from 666 because Linux does not add execute permission to new files by default. Directories usually start from 777 because execute permission is needed to enter a directory.
| Base | Umask | Result |
|---|---|---|
Files: 666 |
022 |
644 |
Directories: 777 |
022 |
755 |
Related workflow
Use this Linux umask calculator to understand default permissions, then use the chmod calculator for existing files when you need to set explicit permissions. Use the all umask values table when you need to compare uncommon masks such as 037, 007, or 277. Read the Linux permission diagnosis guide when ownership, groups, parent directories, setgid, or ACLs may be involved, or the shorter chmod vs umask comparison when deciding only between an existing mode and a future creation default. For shared folders and container services where UMASK=002 can keep files group-writable, read the Docker PUID, PGID, and UMASK permissions guide and the Linux permissions tools hub.
Does this umask calculator upload my input?
No. The umask value is calculated locally in your browser.
Is 0022 the same as 022?
Yes. In common Linux umask examples, 0022 and 022 refer to the same permission mask. The leading zero is part of octal notation.
Which umask gives 644 files and 755 directories?
umask 022 usually creates new files as 644 and new directories as 755 because group and others lose write permission.
How do I calculate umask for files and directories?
Start regular files from 666 and directories from 777, then remove the permission bits blocked by the umask. For example, umask 022 usually gives files 644 and directories 755.
What is the difference between umask and chmod?
Umask controls default permissions for newly created items. Chmod changes permissions on files or directories that already exist. See the chmod vs umask comparison for the decision path.
What is umask 022?
umask 022 removes write permission for group and others, so new files usually become 644 and new directories usually become 755.
What is a safe umask for private files?
umask 077 is a common private default. It usually creates files as 600 and directories as 700, limiting access to the owner.
Why do files use 666 but directories use 777?
Regular files usually start from 666 because execute permission is not added by default. Directories usually start from 777 because execute permission is needed to enter or open a directory.