File permissions, explained
What those three-digit numbers on your files actually control, and why almost everything on a website should be either 755 or 644.
Every file and folder on your hosting account carries a permission setting that decides who can read it, change it, or run it. Most of the time it sits in the background and you never think about it — until an upload that should have worked shows a permission-denied error, or someone reaches for the number "777" as a way to make an error message go away. This article explains what the numbers actually mean, so that the second thing stops happening.
Three kinds of access, for three kinds of user
Permissions work on a model that predates the web by decades and has barely changed since: every file has an owner, a group, and everyone else — usually called other. Each of those three gets its own separate setting for whether it can read the file, write to it, or execute it.
- Owner — normally the hosting account itself, or the specific user that created the file.
- Group — a wider set of accounts that share some level of access, which on shared hosting is usually the web server process that needs to serve your files to visitors.
- Other — anyone and anything else, with no relationship to the file at all.
And the three kinds of access:
- Read — view the contents of a file, or list what is inside a folder.
- Write — change a file's contents, or add and remove files inside a folder.
- Execute — run a file as a program, or open into a folder to see what is inside it.
Where the three-digit number comes from
Read, write and execute are each worth a number: read is 4, write is 2, execute is 1. Adding the ones that apply together gives a single digit for that category of user, and three digits — owner, group, other, in that order — describe the whole file.
| Digit | Permissions granted | Made up of |
|---|---|---|
| 7 | Read, write and execute | 4 + 2 + 1 |
| 6 | Read and write | 4 + 2 |
| 5 | Read and execute | 4 + 1 |
| 4 | Read only | 4 |
| 0 | No access at all | — |
So 755 reads as: the owner gets 7 (read, write and execute), the group gets 5 (read and execute), and everyone else gets 5 too (read and execute, but not write). 644 reads as: the owner gets 6 (read and write), and both group and other get 4 (read only, no writing).
The two numbers you actually need
Almost every file on a website falls into one of two categories, and the correct permission follows directly from which one it is:
| Item | Correct permission | Why |
|---|---|---|
| Folders | 755 | The owner needs to open, list and manage the folder; the web server needs to look inside it to serve files; nobody outside those two needs to add or remove anything directly. |
| Files | 644 | The owner needs to edit the file; the web server, and any visitor, only ever needs to read it — a web page is served by being read, not executed as a program. |
There are narrow exceptions — some scripts genuinely need to be executable, and your hosting platform's own tooling sets those correctly on install — but as a general default, folders at 755 and files at 644 are correct for the overwhelming majority of a website.
777 gives everyone — owner, group and every other user or process on the server — full read, write and execute access. It is sometimes suggested as a quick fix because it does technically make a "permission denied" error disappear, but it does so by removing the protection that stops anything else on the server from modifying your files. On shared infrastructure in particular, this turns a minor inconvenience into a real security exposure. If a permission error will not clear at 755 or 644, the cause is something other than the permission number itself, and it is worth working out what that is rather than opening the file up completely.
Why this exists at all
The point of the model is to separate three things that would otherwise be tangled together: letting you manage your own files, letting the web server read and serve them to visitors, and stopping everyone and everything else from touching them. A file set to 644 can be read by the server (needed for your site to work) and edited by you (needed for you to update it), while remaining closed to writing by anyone else — which is exactly the balance a website needs.
It also explains a specific, common symptom: a file that displays correctly in a browser but cannot be edited through your FTP client is usually one where the owner's write bit has been removed, even though read access for everyone is intact.
How to check and change permissions
Most FTP clients show the permission number next to each file and folder in the listing, and let you change it by right-clicking and choosing something like "File permissions" or "Change permissions". The file manager in your control panel offers the same option under a similar name. Our step-by-step guide to changing file permissions walks through doing this safely, including what to do if a whole folder's contents need updating at once.
If you are seeing a permission-denied error on your site right now rather than reading about permissions in the abstract, fixing permission-denied errors goes straight to diagnosing and clearing that specific problem.
Related reading
Setting the right permission number on a file or folder using your FTP client or file manager, and the one number to never use.
How to fix "permission denied" errorsThe server is doing exactly what it should — refusing a file it has not been given the right access to. Here is how to grant it correctly.
How to set safe file permissionsThe two numbers that cover almost every case on a website: 755 for folders, 644 for files, and why 777 always creates a worse problem.
FTP, FTPS and SFTP: which to useThree protocols with confusingly similar names, one of which sends your password in the open. Here is what actually separates them.