Sooner or later, every website owner bumps into a three-digit number like 644 or 755. Maybe a plugin installation failed with a "permission denied" error, or a security guide told you to "set wp-config.php to 600." It looks cryptic, but the system behind it is simple once you see how it's built.
This guide explains file permissions in plain English, the settings most websites should use, and how to change them safely.
Why file permissions matter
On a Linux web server, every file and folder has rules about who can read it, write to it (change or delete it) and execute it (run it as a program, or enter it if it's a folder).
Get permissions too tight and your site breaks: images won't load, uploads fail, or the server returns errors. Get them too loose and you make life easier for attackers. A world-writable file, for example, can potentially be modified by other processes that shouldn't touch it.
The three groups: owner, group and others
Permissions are set separately for three groups of users:
- Owner (user): the account that owns the file, typically your hosting account username.
- Group: a set of users who share access.
- Others (world/public): everyone else on the system.
The three permissions: read, write, execute
Each group can have any combination of:
| Permission | Letter | Number | On a file | On a folder |
|---|---|---|---|---|
| Read | r | 4 | View contents | List files inside |
| Write | w | 2 | Change or delete | Create, rename or delete files inside |
| Execute | x | 1 | Run as a program | Enter the folder and access files in it |
How the numbers work
Each digit is the sum of the permissions for one group. Add read (4), write (2) and execute (1) as needed:
- 7 = 4 + 2 + 1 = read, write, execute
- 6 = 4 + 2 = read, write
- 5 = 4 + 1 = read, execute
- 4 = read only
- 0 = no access
The three digits are always in the order owner, group, others. So:
- 644 means owner can read and write (6), group can read (4), others can read (4). In letters:
rw-r--r--. - 755 means owner can read, write and execute (7), group and others can read and execute (5). In letters:
rwxr-xr-x. - 600 means only the owner can read and write. Nobody else has access. In letters:
rw-------. - 777 means everyone can do everything. This is almost never what you want.
When you list files in a terminal with ls -l, you'll see the letter form, with a leading d for directories, such as drwxr-xr-x.
Recommended permissions for most websites
On most modern shared hosting, PHP runs as your own account user. On that kind of setup, these defaults are a good starting point:
- Folders: 755. You can manage them, and the web server can enter and read them.
- Files: 644. You can edit them, and the web server can read them.
- Sensitive configuration files: 600 or 640 where your host supports it. Examples include
wp-config.phpfor WordPress or.envfiles for frameworks like Laravel.
Some hosting setups refuse to run PHP scripts that are writable by group or others, returning a 500 error instead. That's a deliberate safety feature, and it's another reason to stick with 644 for PHP files.
What about 777?
Old tutorials sometimes say "set the uploads folder to 777 to fix upload errors." Don't. On a properly configured host, 755 is enough for your uploads folder because PHP runs as your user. If 755 doesn't work, the underlying problem is usually file ownership or server configuration, and your host's support team can help.
Special cases
- Scripts that run from the command line or cron may need the execute bit (for example 700 or 755).
- CGI scripts in a
cgi-binfolder usually need 755. - Hidden files like
.htaccesstypically work fine at 644.
Always check your application's documentation and your host's guidance, since environments vary.
Ownership matters too
Permissions are only half the story. Every file also has an owner and a group. If files end up owned by a different user, for example after restoring a backup from another server or running commands as the root user on a VPS, your site may not be able to write to them even with correct permission numbers.
On shared hosting, you generally can't change ownership yourself, so contact support if you suspect an ownership problem. On a VPS, the chown command sets ownership.
How to change permissions
Using cPanel File Manager
- Log in to cPanel and open File Manager.
- Navigate to the file or folder.
- Right-click it and choose Change Permissions, or select it and click Permissions in the toolbar.
- Tick the boxes or enter the number, then save.
Using DirectAdmin File Manager
Open the file manager, select the item, and use the permissions or "Set Permission" option to enter the numeric value.
Using an FTP client
Most FTP clients, such as FileZilla, let you right-click a file and choose File permissions, where you can enter the numeric value. Some allow applying changes recursively to subfolders.
Using SSH
If you have SSH access, the chmod command sets permissions:
chmod 644 index.php
chmod 755 images
chmod 600 wp-config.php
To reset a whole site to the standard defaults from inside its folder:
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
Be careful running recursive commands. Double-check which folder you're in first, and take a backup beforehand. Our guide to backing up a site in cPanel or DirectAdmin covers how.
Troubleshooting permission problems
- 403 Forbidden errors: a folder may be missing the execute bit, or a file may not be readable. Check for 755 on folders and 644 on files.
- 500 Internal Server Error after changing permissions: PHP files may be group- or world-writable. Set them back to 644.
- "Unable to create directory" during WordPress uploads or updates: check the
wp-contentfolder permissions and ownership. - Images not loading: image files may have been set to 600, which hides them from the web server on some setups.
Permissions and security
Correct permissions are one layer of defense, not a complete security plan. If an attacker gets into your hosting account or exploits a vulnerable plugin, they usually act as your user and can change permissions themselves. Combine sensible permissions with updates, strong passwords and malware scanning. Our WordPress security checklist is a good next step.
Wrapping up
File permissions are three digits representing owner, group and others, with each digit adding up read (4), write (2) and execute (1). For most websites, use 755 for folders, 644 for files and 600 or 640 for sensitive config files, and avoid 777. When something breaks after a permissions change, check ownership too, and ask your host if you're unsure.