Skip to content

chmod Calculator

Covers setuid, setgid, and the sticky bit, which is where the octal notation stops being obvious and starts being the reason a deployment cannot write to a directory.

Runs in your browser Security & crypto
Who Read (4) Write (2) Execute (1) Value

Special bits

Common values

The parts that catch people out

Execute on a directory is not execute
On a directory the execute bit means "may traverse into". A directory with r-- lets you list the names but not stat the entries; --x lets you open a known path but not list it. This is why 755, not 644, is right for directories.
setgid on a directory is the useful one
New files inherit the directory's group instead of the creator's primary group. This is how you make a shared upload directory work without a cron job fixing ownership afterwards.
setuid is ignored on scripts
Linux ignores setuid on interpreted scripts — it was unfixable as a security matter. It only applies to binaries, and it is almost never what you want. Reach for sudo or a capability instead.
The sticky bit restricts deletion
In a world-writable directory such as /tmp, it stops one user deleting another's files. Write permission on a directory otherwise permits deleting anything in it, whatever the file's own permissions say.
umask subtracts, it does not set
A umask of 022 means new files are created 666 & ~022 = 644. Files never get the execute bit at creation regardless of umask — only directories do.