chmod 755 vs 644: Linux File Permissions Explained Simply
What the three digits mean, why folders need 755 and files 644, a quick reference for common modes, and why 777 is almost always the wrong fix.
By the TurantTools Dev team · Updated October 17, 2026 · 4 min read
Sooner or later every developer pastes chmod 755 from a Stack Overflow answer without being sure why. Permissions look cryptic, but there are only three numbers to understand, and once you can read them you'll stop guessing.
Three digits, three groups
Each digit is a group of people: the owner, the file's group, and everyone else. Each digit is a sum of three permissions:
- 4 = read (r)
- 2 = write (w)
- 1 = execute (x)
So 7 = 4 + 2 + 1 (read, write, execute), 6 = 4 + 2 (read, write), 5 = 4 + 1 (read, execute) and 4 is read only.
755 vs 644
| Mode | Symbolic | Owner | Group | Others |
|---|---|---|---|---|
| 755 | rwxr-xr-x | read, write, run | read, run | read, run |
| 644 | rw-r--r-- | read, write | read | read |
For a file, “execute” means it can be run as a program. Your HTML and images don't need that, so 644 is right for them. For a folder, “execute” means you can open it and reach the files inside. Without it, even a readable file in that folder can't be served, which is why folders are usually 755.
A quick reference
| Mode | Use it for |
|---|---|
| 644 | Normal files: HTML, CSS, images, config you only read |
| 755 | Folders and scripts that need to run |
| 600 | Private files: SSH keys, .env, credentials |
| 700 | Private folders such as ~/.ssh |
| 664 / 775 | Files and folders shared with a group |
| 777 | Everyone can write. Almost never what you want |
Why not just use 777?
- It lets any user on the server change or replace the file, including a compromised plugin or another site on shared hosting.
- Some tools refuse to work with it: SSH ignores private keys that others can read, and PHP-FPM setups often block world-writable scripts.
- If something only works at 777, the real problem is usually the file's owner. Fix it with
chowninstead.