StringMash.com

chmod calculator

Octal permissions to rwx letters and back, digit by digit.

Conversion
3 characters
Updates as you type
Symbolicrwxr-xr-x
Owner7 = rwx: read, write, execute
Group5 = r-x: read, execute
Others5 = r-x: read, execute
Commandchmod 755 filename

Show the steps
  1. Each digit is a sum: read is 4, write is 2, execute is 1.
  2. Owner: 7 = 4 + 2 + 1 → rwx (read, write, execute).
  3. Group: 5 = 4 + 0 + 1 → r-x (read, execute).
  4. Others: 5 = 4 + 0 + 1 → r-x (read, execute).

Using it

Type three octal digits, such as 755, or four for the special bits, such as 4755. The output is the permission string as ls -l shows it, and the rows say what the owner, the group and everyone else can do, with the chmod command to copy.

Swap the boxes to go the other way. Paste a string such as rwxr-xr-x, or the whole -rwxr-xr-x from ls -l: the file type letter at the front is ignored.

How the numbers work

Each digit covers one set of people: the file's owner, its group, and everyone else, in that order. Within a digit, read is 4, write is 2 and execute is 1, and you add up the ones you want. 7 is 4 + 2 + 1, all three; 5 is 4 + 1, read and execute; 6 is 4 + 2, read and write. So 755 lets the owner do everything and everyone else read and run it.

Each digit is really three bits, one per permission, which is why permissions are written in octal: one octal digit is exactly three bits.

Each digit

DigitLettersAllows
7rwxread, write, execute
6rw-read, write
5r-xread, execute
4r--read
3-wxwrite, execute
2-w-write
1--xexecute
0---nothing

Common settings

NumberLettersTypical use
755rwxr-xr-xPrograms, scripts and directories others may enter
644rw-r--r--Ordinary files others may read
700rwx------Private directories and scripts
600rw-------Private files, such as SSH keys
775rwxrwxr-xShared directories a group writes to
1777rwxrwxrwt/tmp: anyone can write, only owners can delete

Setuid, setgid and the sticky bit

A fourth digit in front sets three special bits. 4 is setuid: a program runs with its owner's rights instead of the user's, which is how passwd can update a file only root may write. 2 is setgid: a program runs with its group's rights, and on a directory, new files take the directory's group. 1 is the sticky bit: on a directory such as /tmp, people can only delete their own files.

In the letters, they replace the x of the owner, the group or others with s, s or t. A capital S or T means the special bit is set but the x underneath isn't, which is usually a mistake.

Questions

What does chmod 755 mean?

rwxr-xr-x: the owner can read, write and run it; the group and everyone else can read and run it.

What does chmod 644 mean?

rw-r--r--: the owner can read and write; everyone else can only read.

Is chmod 777 safe?

Rarely. It lets anyone on the system change the file. Use it only if you're sure, and never on a web server's files.

What does x mean on a directory?

Permission to enter it and reach the files inside. Read on a directory lets you list the names.

Sources

Added . What's new