File permissions control who can read, write and run the files that make up your WordPress site. Permissions that are too loose let attackers modify files; permissions that are too strict cause errors when WordPress tries to update or upload. Getting them right is a small but important part of security. Here is what the numbers mean and the settings I use.
How permissions work
On Linux servers, each file and folder has an owner, a group and permissions for three types of user: the owner, the group and everyone else. Each can be allowed to read, write or execute. Permissions are often written as three numbers, such as 644 or 755.
Each number is the sum of read (4), write (2) and execute (1). So 7 means read, write and execute; 6 means read and write; 5 means read and execute; 4 means read only.
Recommended settings
For most WordPress sites, files should be 644, meaning the owner can read and write while others can only read, and folders should be 755, meaning the owner can do everything and others can read and enter the folder. These are WordPress’s recommended defaults.
Some hosts use slightly different settings depending on how PHP runs. Follow your host’s recommendations when they differ.
| Item | Permission | Meaning |
|---|---|---|
| Files | 644 | Owner writes, others read |
| Folders | 755 | Owner writes, others enter |
| wp-config.php | 640 or 600 | Owner only, or group read |
| Uploads | 755 folders | No PHP execution |
| Never | 777 | Anyone can write |
Protect wp-config.php
wp-config.php contains database credentials and security keys, making it the most sensitive file. Set it to 640 or 600 where your server allows, so only the owner, and the web server group if needed, can read it.
Some hosts allow moving wp-config.php one level above the web root, which adds a small extra layer of protection.
Never use 777
Permission 777 lets anyone on the server read, write and execute a file or folder. It is sometimes suggested as a quick fix for upload or update errors, but it creates a serious security risk, especially on shared hosting. If a plugin or tutorial asks for 777, find another solution.
Permission errors are usually caused by incorrect ownership rather than permissions that are too strict.
Ownership matters
Files should be owned by the account the web server uses to run PHP, or by your hosting user if PHP runs as that user. Incorrect ownership, often after manual uploads or migrations, causes errors when WordPress tries to install updates or upload media.
Your host can fix ownership, or you can use SSH with the chown command if you have access. Fixing ownership is better than loosening permissions.
The uploads folder
WordPress writes uploaded media to wp-content/uploads, so the web server needs write access there. It should not contain PHP files. Blocking PHP execution in the uploads folder with server rules prevents uploaded malicious scripts from running.
Security plugins and many hosts can add this rule. See WordPress security hardening.
Disable file editing
WordPress includes a theme and plugin file editor in the dashboard. If an administrator account is compromised, attackers can use it to inject code. Add DISALLOW_FILE_EDIT set to true in wp-config.php to remove the editor.
DISALLOW_FILE_MODS goes further and prevents plugin and theme installation and updates from the dashboard, useful for sites managed through deployment workflows.
Checking permissions
Your hosting file manager shows permissions for each file and folder, and you can change them there. FTP clients such as FileZilla also show and change permissions. With SSH, the ls -l command lists them.
Security plugins and Site Health may warn about incorrect permissions on key files.
Fixing permissions in bulk
If permissions are wrong across the site, your host can reset them, or with SSH you can set all folders to 755 and all files to 644 using find commands in the WordPress root. Then tighten wp-config.php separately.
Take a backup before making bulk changes. See a backup strategy that works.
Common errors and causes
‘Could not create directory’ or ‘Installation failed’ during updates, ‘Unable to write to file’ and upload failures often point to ownership or permission problems. WordPress asking for FTP credentials to install plugins also indicates it cannot write files directly.
Check ownership first, then permissions. If the problem started after a migration, file ownership is the likely cause.
Permissions after a hack
Attackers sometimes change permissions to make their files harder to remove or to make core files writable. After cleaning a hacked site, reset permissions to recommended values and check for unexpected executable files.
See what to do when your WordPress site is hacked.
Managed hosting
Many managed WordPress hosts set and maintain correct permissions automatically, and some prevent changes. If you are on managed hosting and see permission errors, contact support rather than changing permissions yourself.
See cPanel basics for shared hosting tools.
Permissions in local and staging environments
Local development tools and staging sites sometimes use looser permissions for convenience. That is fine on your own computer, but never copy those settings to a live server. Migration plugins usually set permissions correctly on the destination, but check after any manual upload.
Deployment tools and Git-based workflows should set ownership and permissions as part of each deployment. Document the expected values so every developer working on the site uses the same settings and nobody resorts to 777 to fix an error quickly.
Getting help
Checking and fixing permissions and ownership is part of my WordPress security audit and website protection service.
For database protection, read WordPress database security.
Key takeaways
- Use 644 for files, 755 for folders and 600 or 640 for wp-config.php.
- Never use 777; fix ownership instead of loosening permissions.
- Block PHP execution in the uploads folder.
- Disable the dashboard file editor with DISALLOW_FILE_EDIT.
Frequently asked questions
What permissions should WordPress files have?
Usually 644 for files and 755 for folders.
Why does WordPress ask for FTP details to install plugins?
It cannot write files directly, usually due to ownership or permissions.
Is 777 ever acceptable?
No, not on a live site.
Should I change permissions on managed hosting?
Usually not. Contact your host if you see errors.
How do I change permissions?
Through your host's file manager, an FTP client or SSH.
Can wrong permissions break my site?
Too strict can cause errors; too loose creates security risks.
