Short answer: on a typical Linux host, set WordPress folders to 755 and files to 644, and tighten wp-config.php to 600 or 640 (or 440 where your host supports it). Never use 777. Just as important is ownership: files should be owned by your user account, with the web server given only the access it needs to write to wp-content/uploads and update plugins. Wrong permissions either break your site or make it much easier for attackers to modify files.
How Linux permissions work
Each file and folder has three sets of permissions: for the owner, the group and others (everyone else). Each set can include read (r = 4), write (w = 2) and execute (x = 1). The numbers add up:

| Number | Meaning | Owner / Group / Others |
|---|---|---|
| 755 | Folders: owner can change; everyone can read and enter | rwx / r-x / r-x |
| 644 | Files: owner can change; everyone can read | rw- / r– / r– |
| 640 | Owner read/write, group read, others none | rw- / r– / — |
| 600 | Only owner can read/write | rw- / — / — |
| 440 / 400 | Read-only for owner (and group) | r– / r– / — |
| 777 | Everyone can read, write and execute | Never use on a live site |
For folders, “execute” means permission to enter the folder, which is why folders need the x bit.
Recommended WordPress permissions
| Path | Recommended | Notes |
|---|---|---|
| All folders | 755 | 750 on some hardened hosts |
| All files | 644 | 640 on some hosts |
wp-config.php |
600 or 640 (440/400 where supported) | Contains database password and keys |
.htaccess |
644 | 444 if you never want WordPress to edit it |
wp-content/uploads |
755 | Web server must be able to write here |
The WordPress documentation notes that the exact scheme depends on your server setup. On hosts where PHP runs as your own user (common with suPHP, PHP-FPM pools per user, or panels like aaPanel and cPanel), 644/755 lets WordPress update itself without loosening permissions. On hosts where PHP runs as a shared web user, the web server may need group write access to specific folders.
Ownership matters as much as permissions
Permissions describe what the owner, group and others can do; ownership decides who the owner is. A common hardening approach:
- Files owned by your SSH/SFTP user, not by the web server user (such as
www-dataorwww). - The web server can read everything but write only where needed (uploads, cache folders).
- Updates performed through WP-CLI or SFTP as your user.
If everything is owned by the web server user, any PHP vulnerability can rewrite your whole site. That convenience is why many hacked sites spread malware into every file.

How to check and fix permissions
Using your hosting file manager, right-click a file and choose Permissions or Change Mode. With SSH, from the WordPress root:
# Folders to 755, files to 644
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
# Lock down wp-config.php
chmod 600 wp-config.php
Check ownership with ls -la, and fix it with chown -R youruser:yourgroup . if your host allows. Take a backup first, and test the site afterwards, including media uploads and plugin updates.
Other hardening tied to permissions
- Disable the dashboard file editor: add
define('DISALLOW_FILE_EDIT', true);towp-config.php. - Block PHP execution in uploads with a web server rule, so uploaded files cannot run as code.
- Move
wp-config.phpone level above the web root if your setup supports it. - See how to secure wp-config.php and hardening WordPress on Apache.
Troubleshooting
- “Installation failed: could not create directory”: the web server cannot write to
wp-content. Check ownership rather than switching to 777. - WordPress asks for FTP details when updating: PHP is running as a different user than the file owner. Fix ownership or use WP-CLI.
- Images will not upload: check that
wp-content/uploadsis writable by the web server. - 500 errors after changing permissions: some hosts reject files that are group- or world-writable. Revert to 644/755.
Frequently asked questions
Is 777 ever acceptable?
No. It lets any process on the server modify your files. Fix ownership instead.
Do permissions stop all hacks?
No, but correct permissions limit what an attacker can change after exploiting a vulnerability.
Should wp-config.php be 400?
400 or 440 is the most restrictive, but on some setups PHP cannot read it and the site breaks. Use the tightest setting that works on your host.
Do I need to reset permissions after updates?
Usually not. If a plugin changes permissions unexpectedly, investigate.
Related: monitoring file changes, WordPress security checklist.

