How to read a chmod number (755, 644, 777)
A three-digit chmod mode is three permission triples: owner, group, others. Each digit is read(4) + write(2) + execute(1).
The bits
So 7 = rwx (4+2+1), 6 = rw- (4+2), 5 = r-x (4+1), 4 = r--.
r= 4 — read a file, or list a directoryw= 2 — write a file, or create/delete names in a directoryx= 1 — run a file, or enter a directory
Common modes
755— owner full; group and others read and execute. Typical for directories and executable scripts you share read-only.644— owner read/write; everyone else read. Typical for ordinary files.600— only owner read/write. Private keys and.envfiles.777— everyone everything. Almost never what you want on a shared host.
Symbolic form
rwxr-xr-x is the same as 755. Leading bits for setuid/setgid/sticky make a four-digit mode (4755), which the chmod calculator also covers.
Questions
- Why can I not enter a directory with 644?
- Directories need execute (
x) to be entered. Use 755 (or 750) for directories, 644 for normal files. - Does chmod change ownership?
- No. Ownership is
chown. Mode ischmod.
Related tool: chmod calculator. Runs in your browser; input is not uploaded.