How the digits add up
Read is 4, write is 2 and execute is 1. A digit is the sum of the permissions you want, so 7 is all three, 5 is read and execute, and 0 is nothing.
The three digits are the owner, the group and others, in that order. 755 therefore means rwx for the owner and r-x for the group and for everyone else.
Worked example
Owner 7, group 5 and other 5 give the mode 755 and the symbolic form rwxr-xr-x. The command is chmod 755 filename.
A file with 644 is rw-r--r--: the owner can read and write, everyone else can only read. That is the usual mode for a web page or a document.
Reading the symbolic form
The nine characters are three groups of three: owner, group and others. Within each group the order is always read, write, execute, with a dash where a permission is absent.
A leading letter can appear in front of the nine, such as d for a directory or l for a symlink. Those are file types, not permissions, and they are not part of the mode.
Limits of this calculator
It covers the three-digit base permissions. It does not model setuid, setgid or the sticky bit, which add a fourth leading digit, and it does not apply the change to any file.
It also does not account for ACLs, mount options or whether the user running the command owns the file.
For another computing conversion, use the data calculator.
Inputs for the chmod calculator
Owner permissions
The first digit, for the user who owns the file. 7 is read, write and execute.
Group permissions
The second digit, for members of the file's group.
Other permissions
The third digit, for everyone who is neither the owner nor in the group.
CALCULATOR QUESTIONS
Chmod calculator questions
What does 755 mean?
Owner can read, write and execute; group and others can read and execute. It is the usual mode for a directory or an executable script.
Why is 777 a bad idea?
It lets anyone write to the file or directory, which is rarely what you want on a shared or internet-facing system.
What about setuid and sticky bits?
They use a fourth leading digit, such as 4755 or 1777. This page covers the three-digit form only.
Does chmod apply to directories differently?
Yes. Execute on a directory means you can enter it, and read means you can list it, which is why directories usually need 755.
