How file permissions work
On Linux servers — which run most websites — every file and folder says who may read it, change it and run it. There are three groups of people: the owner, the owner’s group, and everyone else. Each permission has a value: read is 4, write is 2 and run (execute) is 1. Add them up for each group and you get three digits, such as 755.
Common settings
- 755 (rwxr-xr-x): folders, and scripts that need to run. Everyone can read and open them; only you can change them.
- 644 (rw-r--r--): normal files such as HTML, images, CSS and PHP on most hosts.
- 600 (rw-------): private files only you should read, such as keys.
- 640: config files with passwords, such as wp-config.php, when your host recommends it.
- 777: everyone can change the file. Avoid it — on a shared server it lets other accounts and attackers change your site.
How to change permissions
- In cPanel or hPanel File Manager: right-click the file, choose Permissions (or Change Permissions), and enter the number.
- In an FTP program such as FileZilla: right-click, choose File permissions, and type the number.
- Over SSH: copy the chmod command shown here.
Frequently asked questions
What does chmod 755 mean?
The owner can read, write and run; the group and everyone else can read and run, but not change it. It is the usual setting for folders.
Should I use 777 to fix a permission error?
No. It works by letting everyone change the file, which is a security hole. Find out which user needs access and give only that, usually with 755 or 775 for a folder.
Why do folders need the “run” permission?
For a folder, “run” means being allowed to open it and reach the files inside. Without it, a folder’s files cannot be served even if they are readable.