How it works
In Unix and Linux, each file has permissions for three classes: the owner user, the group, and the rest ("others"). Each class can have three permissions: read (r), write (w), and execute (x). chmod is the command that changes them.
Permissions are represented in two equivalent ways: numeric (octal) and symbolic. In octal each class is a digit from 0 to 7, the sum of 4 (read) + 2 (write) + 1 (execute). In symbolic they are written as nine characters, for example rwxr-xr-x.
An initial fourth digit controls the special bits: setuid (4), setgid (2), and sticky (1). This tool converts both ways: check the permissions with the boxes to get the octal, the symbolic notation, and the ready-to-copy command, or paste a value to see it reflected.
Examples
755rwxr-xr-xThe owner can read, write, and execute; the group and others only read and execute. Typical of directories and scripts.644rw-r--r--The owner reads and writes; the group and others only read. Common in data and configuration files.600rw-------Only the owner can read and write; no one else has access. Recommended for private keys.4755rwsr-xr-xThe first digit 4 enables setuid: the program runs with the privileges of the file's owner.Use cases
- Give execute permission to a script (chmod 755) or restrict a file with sensitive data (chmod 600).
- Translate between the octal number in a tutorial and what ls -l shows, without calculating the bits by hand.
- Understand what permissions a command actually grants before running it on a server.
Frequently asked questions
Why are 755 only three digits, and sometimes four appear?
The three digits represent user, group, and others. The fourth digit, optional and at the beginning, controls the special bits (setuid, setgid, sticky); if it is 0 it is omitted, which is why 0755 and 755 are the same.
What do the s and t mean in rwsr-xr-t?
They replace the x to indicate a special bit. The s in the user block is setuid, in the group block it is setgid; the t in the others block is the sticky bit. In uppercase (S/T) the bit is active but without execute permission.
What is the difference between chmod 755 and chmod u=rwx,g=rx,o=rx?
None: they produce exactly the same permissions. The octal form is more compact and the symbolic one is more readable. chmod also accepts relative changes such as u+x (add execute to the owner) without touching the rest.
What permissions should a private SSH key have?
600 (rw-------). SSH refuses to use a private key if the group or others can read it. The ~/.ssh folder usually uses 700.