What it does
Converts between an octal mode, an ls -l string and checkboxes. The second box applies a chmod expression to a current mode, and the last one shows what a umask gives new files and directories. The rules are a port of GNU coreutils chmod.
Examples
| Input | Result |
|---|---|
755 | rwxr-xr-x — owner everything, others read and execute |
640 | rw-r----- — common for config files |
4755 | rwsr-xr-x — setuid (programs like passwd) |
1777 (directory) | drwxrwxrwt — a shared directory like /tmp where users cannot delete each other's files |
u+x,g-w on 644 | 744 |
+w on 644 (umask 022) | 644 — without a, bits set in the umask (group and other write) are skipped. a+w gives 666 |
umask 027 | new file 640 · new directory 750 |
Common mistakes
- Removing x from directories — on a directory
xmeans "enter". Runningchmod -R 644over a tree makes the files inside unreachable. For mixed trees use capitalX(execute only for directories or files that already have it):chmod -R u=rwX,go=rX. - Hiding a problem with 777 — a web server 403 is usually a missing
xon a parent directory or the wrong owner. 777 lets anyone change the files. - setgid on a directory will not go away — GNU
chmod 755 dirkeeps an existing setgid. Usechmod g-s diror the 5-digit00755.
How it was checked
Before publishing, 286 checks were run with GNU coreutils 9.4 chmod, stat -c '%a %A' and bash umask plus touch/mkdir on this server: 20 octal modes on files and directories, 37 expressions on files and directories under umask 022 and 027, 8 expressions chmod rejects and 10 umask values. That includes the cases where chmod warns and exits with status 1 because of the umask.
FAQ
Is 755 different from 0755?
No, they behave the same on files and directories; the leading 0 just says "no special bits". On directories, though, GNU chmod does not clear setuid or setgid with a numeric mode of up to four digits, so both keep an existing setgid. Write five digits, 00755, to clear it.
My umask is 022, so why are new files 644 and not 755?
New files usually start from 666 (they are created without execute bits); removing 022 gives 644. Directories start from 777 and end up 755. A umask only removes bits, it never adds them.
Is what I type sent to a server?
No. Everything is calculated in your browser. Input is not sent to a server and is not passed to the analytics or ads this site uses. See the privacy notice.