StackPractices

Chmod Calculator

Convert between octal and symbolic permissions, see exactly what each class can do, and get warned about dangerous combinations like world-writable executables. Everything runs in your browser — and unlike most chmod calculators, this one understands the difference between files and directories, warns about unsafe combinations and simulates exactly what the owner, group members or everyone else can do.

1. Type of target

Matters because x means “execute” on files but “enter/traverse” on directories — and the security analysis changes accordingly.

2. Permission matrix
read write execute
Owner
Group
Others
3. Or type it directly

Accepts rwxr-xr-x or clauses like u+rwx,g=rx,o= (Enter or blur to apply)

Common presets

4. umask explorer

Result

live

Octal

0644

Symbolic

rw-r--r--

Command

chmod 644 file

Who can do what

Unix checks owner first, then group, then others — the first matching class decides everything.

Security analysis

Applying recursively, the safe way

chmod -R applies the same mode to files and directories — almost never what you want, since directories need x and most files do not. Use find with separate modes instead:

How Unix permissions actually work

Every file and directory carries twelve permission bits: nine for the owner, group and others (read, write, execute each), plus three special bits (setuid, setgid, sticky). The octal notation is just those bits packed into digits — 7 is rwx, 5 is r-x, 4 is read-only.

The bit values

Digit Binary Meaning
7111read + write + execute
6110read + write
5101read + execute
4100read only
0000no permissions

Directories are not files

The single most misunderstood part of chmod: on a directory, execute means traverse. You need x on every directory in a path to reach a file inside it. Read on a directory only lets you list names. That is why web roots are 755 for directories but 644 for files — and why a blind chmod -R 755 wrongly makes every file executable.

Permissions worth memorizing

Mode Use case Why
600SSH private keys, secrets, .env filesOnly the owner can read or write; OpenSSH rejects looser keys
644Web content, source files, configsWorld-readable, owner-writable — the sane default for files
700~/.ssh, private directoriesOwner-only access including traversal
755Scripts, binaries, public directoriesEveryone can execute/enter, only the owner can modify
1777/tmp-style shared scratch dirsEveryone can write, but the sticky bit protects each user's files from others

Frequently asked questions

What does chmod 755 mean?

chmod 755 gives the owner read, write and execute permissions (7 = rwx) while group and others get read and execute only (5 = r-x). It is the standard permission for executable scripts, binaries and directories that should be world-readable but only writable by their owner.

What is the difference between chmod 644 and 755?

644 (rw-r--r--) is for regular files: the owner can read and write, everyone else can only read. 755 (rwxr-xr-x) adds execute permission for everyone — use it for scripts, binaries and directories. Never use 755 for files that are not meant to be executed.

Why is chmod 777 dangerous?

chmod 777 makes a file or directory readable, writable and executable by every user on the system. Any local user — or any compromised process — can modify or replace the file, which is a classic privilege-escalation path. It is almost never the right answer; fix ownership or group membership instead.

What do the special bits setuid, setgid and sticky mean?

Setuid (4xxx) makes an executable run with the file owner's privileges. Setgid (2xxx) does the same with the group, and on directories it makes new files inherit the directory's group. The sticky bit (1xxx) on a directory like /tmp means only the file owner can delete their own files, even though everyone can write there.

What does x mean on a directory?

On a directory, execute (x) means traverse: you can enter the directory and access files inside it. Read (r) without x lets you list filenames but not open anything. This is why directories need x almost everywhere — a directory with r but no x is a common cause of "permission denied" even when the file inside is readable.

How does umask affect file permissions?

The umask subtracts permissions from the default creation mode: files start at 666 and directories at 777, minus the umask. With the common umask 022, new files get 644 and new directories 755. This calculator shows the effective result of any umask so you do not have to compute it in your head.

What permissions should SSH private keys have?

Private keys must be 600 (rw-------) or 400 — readable only by their owner. OpenSSH refuses to use keys with looser permissions. The ~/.ssh directory itself should be 700, and authorized_keys 600.