How chmod Numbers Work
A chmod mode is three octal digits — one each for owner, group, and others. Each digit is the sum of three bits:
| Bit | Value | Meaning |
|---|---|---|
| read (r) | 4 | view file / list directory |
| write (w) | 2 | modify file / add-remove entries |
| execute (x) | 1 | run file / enter directory |
Add the bits you want per role. 7 = 4+2+1 = rwx, 6 = 4+2 = rw-, 5 = 4+1 = r-x, 4 = r--.
Single-Digit Reference
| Octal | Binary | Symbolic | Permissions |
|---|---|---|---|
| 0 | 000 | --- | none |
| 1 | 001 | --x | execute |
| 2 | 010 | -w- | write |
| 3 | 011 | -wx | write + execute |
| 4 | 100 | r-- | read |
| 5 | 101 | r-x | read + execute |
| 6 | 110 | rw- | read + write |
| 7 | 111 | rwx | read + write + execute |
Common Modes
| Mode | Symbolic | Typical use |
|---|---|---|
| 777 | rwxrwxrwx | Everyone full access — avoid; almost never correct |
| 755 | rwxr-xr-x | Executables, directories, web content |
| 700 | rwx------ | Private scripts/dirs (owner only) |
| 644 | rw-r--r-- | Regular files (owner edits, others read) |
| 640 | rw-r----- | Config readable by group, not world |
| 600 | rw------- | Private files (SSH keys, secrets) |
| 444 | r--r--r-- | Read-only for everyone |
Files vs Directories
The execute bit means different things:
- On a file,
xlets you run it as a program/script. - On a directory,
xlets youcdinto it and access its contents. A directory withrbut noxlets you list names but not open anything — usually a mistake. That's why directories are typically755, not644.
Quick Tips
- Web servers usually want
755for directories and644for files. - SSH is strict:
~/.sshmust be700and private keys600, or it refuses them. chmod -Rapplies recursively — be careful applying file modes to directories (you'll strip the neededx).
Frequently Asked Questions
What does chmod 777 mean? Read, write, and execute for owner, group, and others — full access for everyone. It's a security risk and rarely the right answer; prefer 755 or 644.
What is the difference between 755 and 644? 755 (rwxr-xr-x) includes the execute bit, used for directories and executables. 644 (rw-r--r--) has no execute, used for regular files.
Why do SSH keys need chmod 600? SSH refuses to use a private key that other users can read. 600 (rw-------) restricts it to the owner only.
Compute any mode visually with the chmod calculator, and learn the model in depth in Linux File Permissions Explained.