chmod Symbolic Octal Converter
Convert chmod modes between octal and symbolic notation: 755 to u=rwx,g=rx,o=rx and back. Also applies changes like u+x or go-w to a current mode, handles setuid, setgid, and the sticky bit, and reads ls -l strings. Runs in your browser.
Input
The mode before the change, used by symbolic modes such as u+x. + and - add to it and remove from it.Limits symbolic changes without u, g, o or a, such as +w.
Output
Readme
What are octal and symbolic chmod modes?
chmod sets the permissions of a file on Linux, macOS, and other Unix systems, and it accepts them in two notations. An octal mode such as 755 has one digit each for the owner, the group, and everyone else, where read is 4, write is 2, and execute is 1. A symbolic mode such as u=rwx,g=rx,o=rx names the classes (u owner, g group, o others, a all) and the permissions (r, w, x) instead.
Symbolic modes can also change permissions instead of setting them all: u+x adds execute for the owner, go-w removes write for group and others, and g=u copies the owner's permissions to the group. An octal mode always sets every permission, so the octal result of a change depends on the mode the file had before.
Tool description
This tool converts chmod modes between octal and symbolic notation. Pick the source and target notation, or leave the source on auto-detect: enter 755 to get u=rwx,g=rx,o=rx, or enter a symbolic mode to get the octal value. For changes like u+x or a+X, enter the file's current mode and see the mode chmod would leave it with. You can also paste a permission string from ls -l, such as -rwxr-xr-x, or a whole chmod command.
Examples
| Octal | Symbolic | ls -l | Typical use |
|---|---|---|---|
| 644 | u=rw,go=r |
-rw-r--r-- |
Regular files |
| 755 | u=rwx,go=rx |
-rwxr-xr-x |
Scripts, programs, and directories |
| 600 | u=rw,go= |
-rw------- |
Private files such as SSH keys |
| 2775 | u=rwx,g=rwxs,o=rx |
drwxrwsr-x |
Shared directories that keep their group |
| 1777 | a=rwx,+t |
drwxrwxrwt |
/tmp and other shared scratch folders |
| 4755 | u=rwxs,go=rx |
-rwsr-xr-x |
Programs such as passwd |
Features
- Converts octal to symbolic and symbolic to octal, with a swap button to switch direction
- Detects the notation of the mode you enter, or converts from the notation you pick
- Applies relative changes such as
u+x,go-w,a=r,u+w,g=u, anda+Xto a current mode - Handles setuid, setgid, and the sticky bit (
s,t, and 4-digit octal modes) - Writes the symbolic mode in full (
u=rwx,g=rx,o=rx) or compact (u=rwx,go=rx) - Reads and writes
ls -lpermission strings, includings,S,t, andT - Accepts pasted commands such as
sudo chmod -R 755 dir - Points to the exact character when a mode is invalid
How it works
An octal mode is read as up to four digits: the optional first digit holds setuid (4), setgid (2), and sticky (1), and the other three hold the owner, group, and others permissions. A symbolic mode is read clause by clause, following the POSIX grammar, and applied to the current mode the way GNU chmod on Linux does:
+adds permissions,-removes them, and=sets them and clears the rest for the classes named.Xadds execute only to directories and to files that already have execute for someone.ssets setuid withuand setgid withg.tsets the sticky bit witho,a, or no class.- Without a class, as in
+x, the change applies to everyone except the bits blocked by the umask. - On directories, setuid and setgid stay as they are unless the mode names them, as in
g-s.
The symbolic output sets every bit explicitly, so on a file it gives the same result whatever mode the file had before. The sticky bit is written as a separate +t clause because GNU and BSD chmod both accept it in that form.
Tips
- Use
a+Xwithchmod -Rto make directories searchable without making every file executable. chmod 755on a directory doesn't clear setgid with GNUchmod. Usechmod 00755org-sto remove it.- Ansible and many config files expect a leading zero, as in
0755. Turn on "Always show 4 octal digits" to get it. - A
.or+after anls -lstring marks an SELinux context or an ACL. Usegetfaclto see ACL entries, which the mode doesn't show.