Skip to content
gohacks.dev
Tooling

umask Calculator

Enter a umask such as 022 or 027 and see the permissions new files and directories get, in octal and rwx form, with the symbolic umask -S equivalent.

Free · No sign-up · Your inputs stay in your browser

Input

Work out what a umask creates

Output

Files 640, directories 750

New files

640 rw-r-----

New directories

750 rwxr-x---

Symbolic (umask -S)

u=rwx,g=rx,o=

A umask removes permission bits from the defaults programs ask for: 666 for files and 777 for directories. That is why no umask produces an executable file: execute has to be added with chmod. Set it for a service with UMask= in its systemd unit, and for a shell in ~/.profile.

Runs in this browser. Nothing you paste is sent to a server.

Common values

022 gives 644 files and 755 directories: everyone can read, only the owner writes. 002 gives 664 and 775 for teams that share a group. 027 removes all access for others, a sensible default on servers, and 077 makes everything private. The umask(2) manual describes the mechanism.

Setting it for a service

A shell sets it in ~/.profile, but services started by systemd ignore your shell. Use UMask=0027 in the unit file, and PHP-FPM's or Nginx's own umask behaviour for files they write, such as uploads and logs.

Share

Frequently asked questions

Why can a umask never create an executable file?
Programs request 666 for ordinary files, without execute bits, and the umask only removes bits. Execute permission is added afterwards with chmod +x.
What is the difference between umask 022 and 0022?
None. The leading digit is for the special bits (setuid, setgid, sticky) and is almost always zero, so umask prints four digits and accepts three.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools