chmod 755 vs 644: which permissions for files, folders, and scripts
The two numbers cover most of what a web server needs. What each digit means, which to pick, and the cases where neither is right.
Tools used in this guide
The job
A file uploaded to a server has the wrong permissions and the site breaks — or worse, a private file becomes readable. The chmod calculator shows octal and symbolic forms side by side so you can check before you run the command.
What the digits mean
Each digit is read(4) + write(2) + execute(1), for owner, group, and other in that order. 644 = rw-r--r-- : the owner can edit, everyone can read. 755 = rwxr-xr-x : the owner can also run it.
- 644 — web pages, images, config files that the server only reads.
- 755 — directories and scripts: a directory needs x to be entered at all.
- 600 — private keys and credential files: rw-------, owner only.
- 700 — private directories: rwx------.
Worked example
Deploying a site: index.html gets chmod 644, the css/ directory gets 755, deploy.sh gets 755, and .env or an SSH key gets 600 — never 644, or anyone on the machine can read your secrets. Tick the boxes in the calculator to see both notations update together.
What this does not cover
Special bits — setuid, setgid, sticky — add a fourth leading digit (e.g. 1755 on a shared directory) and are outside this tool's scope. On managed hosting the effective permission can also be shaped by ACLs and the umask; chmod is only the final layer.