How to use
- Tick checkboxes for read (r), write (w) and execute (x) for the owner, group and others, or type a value into the input at the top. Whichever side you change, the octal and symbolic forms update together.
- The input accepts octal (
755,4755), symbolic (rwxr-xr-x, or-rw-r--r--copied fromls -l) and mode expressions (u+x,go-w,a=r,u=rwx,g=rx,o=). An expression is applied to the permissions currently shown, and a missing target meansa(everyone). - Enter a file name to get a command such as
chmod 755 script.sh. Names with spaces or special characters are wrapped in single quotes, and names starting with-get a--in front. - Preset buttons fill in 644, 755, 600, 700, 664, 775 and 777. Open “Advanced” to turn on setuid, setgid and sticky.
The math: r=4, w=2, x=1
Each digit is the sum of the permission values for one class. The digits go in the order owner, group, others.
| Permission | Sum | Digit | Symbolic |
|---|---|---|---|
| none | 0 | 0 | --- |
| execute | 1 | 1 | --x |
| write | 2 | 2 | -w- |
| write + execute | 2+1 | 3 | -wx |
| read | 4 | 4 | r-- |
| read + execute | 4+1 | 5 | r-x |
| read + write | 4+2 | 6 | rw- |
| all | 4+2+1 | 7 | rwx |
For example, 750 is 7 (rwx) for the owner, 5 (r-x) for the group and 0 (---) for others, which gives rwxr-x---. The same permissions in symbolic form are chmod u=rwx,g=rx,o=. With four digits, the first one holds the special bits. With fewer than three digits, missing leading digits are filled with 0 (75 becomes 075).
Files and directories behave differently
| Permission | On a file | On a directory |
|---|---|---|
| Read (r) | Contents can be read | The list of entries can be shown |
| Write (w) | Contents can be changed | Entries can be created, deleted and renamed (also needs x) |
| Execute (x) | Can be run as a program or script | Can be entered (cd) and its entries accessed |
Without execute on a directory you cannot open the files inside, even if you can read the directory. That is why directories usually use values with x set, such as 755 or 700.
Common permissions
| Value | Symbolic | Typical use |
|---|---|---|
| 644 | rw-r--r-- |
Regular files: owner edits, everyone else reads |
| 755 | rwxr-xr-x |
Executables, scripts and directories |
| 600 | rw------- |
Files only you may read and write, such as an SSH private key |
| 700 | rwx------ |
A directory only you use |
| 664 / 775 | rw-rw-r-- / rwxrwxr-x |
Files / directories edited by a shared group |
| 777 | rwxrwxrwx |
Anyone can read, write and execute. Avoid it |
777 means any other account on the machine, or any compromised process, can change or delete the file. Instead of using 777 to silence a permission error, decide which user or group needs access, fix the owner and group, and use 664 or 775. This tool shows a warning whenever others have write permission.
Special bits
| Name | Value | Symbolic | Effect |
|---|---|---|---|
| setuid | 4 | s in the owner x slot (S without x) |
Runs with the file owner’s privileges |
| setgid | 2 | s in the group x slot (S without x) |
Runs with the file’s group; on a directory, new files inherit the directory’s group |
| sticky | 1 | t in the others x slot (T without x) |
Entries in the directory can be deleted only by their owner or the directory owner; /tmp is the classic case |
4755 is rwsr-xr-x, 1777 is rwxrwxrwt and 2750 is rwxr-s---. In mode expressions s and t are switched on and off like +s and -t: u+s changes setuid, g+s changes setgid and +t changes sticky.
Reading ls -l output
In -rwxr-xr-x 1 user staff 120 Oct 7 10:00 run.sh, the first character is the type (- file, d directory, l symbolic link) and the next nine characters are the permissions for owner, group and others. Copy only the first ten characters (-rwxr-xr-x) into the input and it reads as 755; do not paste the whole line. The default permissions of a new file come from umask; with the common 022, files get 644 and directories get 755. An expression without a target, such as +x, applies to everyone here and does not take umask into account.
For number conversion try the Number Base Converter, for scheduled jobs the Cron Expression Parser, and for integrity checks the Hash Generator.
The values you enter are processed only in your browser and are never sent to a server.