Chmod Calculator – Linux File Permissions
Convert Linux file permissions between a clickable checkbox grid, octal code (e.g. 755) and symbolic notation (e.g. rwxr-xr-x). Get ready-to-use chmod commands, an ls -l preview and security notes for regular files and directories.
Convert Linux Permissions Between Checkboxes, Octal and Symbolic Notation
Chmod Formula
Where:
- \(r\), \(w\), \(x\) — the read, write and execute bits, each 1 if the permission is granted and 0 if not;
- \(d\) — the octal digit for one class (owner, group or others), built from the 4–2–1 weights;
- \(s_{\text{uid}}\), \(s_{\text{gid}}\), \(s_{\text{sticky}}\) — the setuid, setgid and sticky special bits (also 0 or 1).
Each permission class gets one octal digit because read counts as 4, write as 2 and execute as 1; adding the granted values gives a number from 0 to 7. The optional leading digit encodes the special bits with the same 4–2–1 weights, so 4755 means setuid plus the familiar 755.
Chmod – Calculation Example
Example: a script that the owner may freely edit and run, the group and everyone else may only read and run — the classic 755 setup (this is also the calculator's default grid: owner r+w+x, group r+x, others r+x).
\[ d_{\text{owner}} = 4 + 2 + 1 = 7 \]
\[ d_{\text{group}} = 4 + 0 + 1 = 5 \]
\[ d_{\text{others}} = 4 + 0 + 1 = 5 \]
\[ \text{mode} = 755 \]
Result: octal mode 755, symbolic mode rwxr-xr-x, command chmod 755 file. In an ls -l listing the file appears as -rwxr-xr-x.
How to use the calculator
- Open the Input method dropdown and pick how you want to describe the permissions: Checkboxes (permission grid), Octal code, Symbolic notation or Common presets. Only the fields belonging to the chosen method stay visible.
- With Checkboxes, tick Read, Write and Execute for each class — Owner (u), Group (g) and Others (o) — and optionally the special bits Setuid, Setgid and Sticky.
- With Octal code, type three digits (e.g. 755) or four with a leading special digit (e.g. 4755). With Symbolic notation, enter nine characters such as rwxr-xr-x, or paste a full
ls -lstring like-rwxr-xr-x— the leading type character is stripped automatically. With Common presets, just select a ready-made permission set. - Set File type to Regular file (-) or Directory (d) so the explanation and the
ls -lpreview use the right wording. - Read the results: the numeric (octal) mode, the symbolic mode, ready-to-copy chmod commands, an ls -l style preview, a plain-English explanation and security notes.
What Linux file permissions are and how to read them
Every file and directory on a Linux system carries nine permission bits, divided into three classes: the owner (u) who created the file, the group (g) the file belongs to, and others (o) — everyone else on the machine. Within each class, three bits say whether the class may read (r), write (w) and execute (x) the file. The chmod command changes these bits, and the calculator translates any representation of them into all the others.
The octal notation packs each class into one digit using the 4–2–1 weights, which is why you see modes like 644 or 755. The symbolic notation spells the same bits out as nine characters read left to right: owner triplet, group triplet, others triplet. A dash means the permission is missing, so rw-r--r-- is the readable-but-not-executable 644. Both forms describe exactly the same bits — pick whichever the tool in front of you accepts.
The meaning of the bits depends on the file type. For a regular file, r means view its contents, w means change them and x means run it as a program. For a directory, r means list the names inside, w means create, rename or delete entries inside, and x means enter it with cd and open the files within. That is why a directory needs x for its contents to be usable, and why 700 is the standard mode for private folders such as ~/.ssh.
Three extra special bits round out the picture. Setuid (4) makes an executable run with its owner's privileges — the mechanism behind /usr/bin/passwd. Setgid (2) does the same for the group, and on directories it makes new files inherit the directory's group. Sticky (1) restricts deletion in a shared writable directory so users can remove only their own files — the rule that keeps /tmp (1777) safe. In symbolic output these appear as s/S in an execute slot or t/T in the final slot; the capital form indicates the execute bit underneath is off.
Common permission modes
| Mode | Symbolic | Typical use |
|---|---|---|
| 600 | rw------- | Private files such as SSH keys |
| 644 | rw-r--r-- | Ordinary files, web content |
| 700 | rwx------ | Private directories such as ~/.ssh |
| 755 | rwxr-xr-x | Programs, scripts, web-served files |
| 775 | rwxrwxr-x | Shared directories for a trusted group |
| 1777 | rwxrwxrwt | Shared scratch space like /tmp |
| 4755 | rwsr-xr-x | Setuid root executables (use sparingly) |
Assumptions, limitations and practical tips
- 777 is almost never the answer. Making a file world-writable opens it to every account on the system. Prefer 775 with a properly chosen group, or ACLs (
setfacl), before reaching for 777. - Never combine world-writable with setuid or setgid. Modes like 4777 or 7777 let anyone replace the file while it still runs elevated — a classic privilege-escalation hole.
- Others should not outdo the owner. If the third digit exceeds the first, you have almost certainly mistyped the mode; the security notes will flag it.
- 000 blocks everyone, including the owner. Only root can recover access, so use 600 or 700 instead when you want privacy.
- Be careful with
chmod -R. A recursive numeric mode overwrites all bits on every file and subdirectory at once; directories usually need x while data files should not have it. Apply modes per file type rather than blasting a whole tree. - Root ignores permission bits. Permissions constrain normal users; they are not a protection against root-level access.
- The calculator maps known permission representations onto each other, including special bits, but cannot account for ACLs, SELinux or other mandatory access controls that may also affect real-world access.
If you work with other Linux-side encodings, you may also find the Unix timestamp converter, the hex converter and the binary calculator useful for understanding the underlying number systems.
Frequently Asked Questions
How do I set different permissions for files and directories recursively?
Use find to apply a separate mode to each file type: find /path -type d -exec chmod 755 {} + for directories and find /path -type f -exec chmod 644 {} + for files. A plain chmod -R 755 gives data files an execute bit they don't need, while -R 644 strips the x bit from directories, making them impossible to enter. Splitting by type avoids both mistakes.
How can I see the current permissions of a file as an octal number?
Run stat -c '%a' filename (or stat -f '%Lp' filename on macOS) and you get the mode directly as digits like 644. The long listing from ls -l only shows the symbolic form, which you then have to decode yourself. This octal output is exactly what the calculator's Octal code field expects, so you can paste it in and review what each bit does.
Why do I still get "Permission denied" after chmod?
Check three things: the directory along the path must grant you x (execute) for you to reach the file — a 644 directory blocks everything inside it even if the file is 777. You also cannot chmod a file you don't own, and finally filesystem-level rules may override the bits: mount options like noexec, ACLs, SELinux or AppArmor can deny access regardless of the mode.
What does chmod a+r mean, and how is it different from o+r?
a means "all" — it applies the change to owner (u), group (g) and others (o) at once, so a+r grants read to everybody. o+r touches only the others class. In octal there is no such shortcut: a numeric mode always overwrites all nine bits, which is why classes that should keep their existing bits are better adjusted with symbolic + and − instead of a full numeric replacement.
Why do my new files get 664 instead of 755? What is umask?
umask is a per-shell setting that cuts bits off the mode a program requests when creating a file. With the common umask 002, a program asking for 666 (rw-rw-rw-) gets 664, and a directory request of 777 yields 775. Check yours with umask and change it with e.g. umask 022. chmod is not involved at creation time — it only rewrites bits afterwards.
Why doesn't setuid work on my shell script?
Most Linux systems deliberately ignore the setuid bit on interpreted scripts (shell, Python and similar) because the interpreter — not the script — is what actually executes, and interpreters run as the caller. Setuid has effect almost only on compiled binaries like /usr/bin/passwd. If you need elevated actions from a script, use sudo rules instead of hoping chmod 4755 on a script will help.