AI Audit Schedule a Call
Security Plugins & Hardening November 26, 2026

WordPress File Permissions and wp-config Hardening

WordPress File Permissions and wp-config Hardening
On this page
  1. Key takeaways
  2. What are the recommended WordPress file permissions?
  3. What should wp-config.php permissions be: 400, 440, 600 or 644?
  4. Why does file ownership matter as much as the number?
  5. Is 777 ever safe for wp-content or uploads?
  6. How do you harden wp-config.php beyond permissions?
  7. What are WordPress security keys and salts?
  8. What the evidence does not tell you
  9. Where to get help with WordPress file permissions
  10. Frequently asked questions

WordPress file permissions are usually set to 755 for folders and 644 for files, according to the WordPress Advanced Administration Handbook. The one file that should be tighter is wp-config.php, which the handbook says should be 440 or 400 on suexec setups. File ownership and the security keys inside wp-config.php matter as much as the numbers.

This article covers the official baseline, why sources disagree on wp-config.php, what else to protect in that file, and how keys and salts work. If you would rather not manage this yourself, our website care and maintenance service covers ongoing WordPress upkeep.

Key takeaways

  • The official baseline is 755 for folders and 644 for files, with 750 and 640 allowed under suexec.
  • The handbook calls the default 644 on wp-config.php “a hazard” and recommends 400 or 440 where the PHP user owns the file.
  • Vendors and forum users give other numbers (600, 644), so the right value depends on who owns the file.
  • Permissions do not stop every attack. A file-read exploit can return wp-config.php even at 400, according to Sucuri (vendor-reported).
  • The WordPress.org service generates eight keys and salts. Changing them logs every user out.

The WordPress Advanced Administration Handbook says folders often use 755 and files 644. Its Hardening page gives find and chmod commands for exactly those values. Both pages were last updated October 14, 2026.

The handbook allows variations. Group-writable setups may need 775 for folders and 664 for files. On shared hosting with suexec, it says all directories should be 755 or 750 and all files 644 or 640.

ItemHandbook valueNotes
Folders755 (750 under suexec)775 if group-writable
Files644 (640 under suexec)664 if group-writable
wp-config.php400 or 440Initially created as 644
.htaccess644Normally required and recommended
wp-contentWritable by your account and the web serverNo number on the Hardening page

The Hardening page says root files should be writable only by your user account. The exception is .htaccess, if you want WordPress to generate rewrite rules automatically. For wp-content, the page says it is intended to be writable by your user account and the web server process, and the Hardening page gives no number for it.

Table-style graphic of recommended WordPress file and folder permissions
Official WordPress handbook values for the main file types.

What should wp-config.php permissions be: 400, 440, 600 or 644?

The official answer is 400 or 440. The File Permissions page says wp-config.php “is initially created with 644 permissions, and it’s a hazard to leave it like that,” and gives 440 or 400 for suexec setups. The Hardening page says the file generally means a 400 or 440 permission.

Other sources disagree, and you will see all of these numbers online:

Sourcewp-config.php adviceType
WordPress Handbook400 or 440; 644 is a hazardOfficial
Sucuri“Something along the lines of 600 should be sufficient”; start at 400 and loosen only if neededVendor-reported
Kinsta644 is “a good starting point” and used on its own platform; 400 is the least permissive optionVendor-reported
WordPress.org support thread (2016)One user keeps 0400 on shared BlueHost hosting, others use 600; the asker chose 600Anecdotal

Kinsta is a managed host, so its advice reflects how its own servers are set up. Sucuri sells a firewall and a security plugin. The practical rule that reconciles these views is to start at 400, and loosen the value only if the site cannot read its own config file. What counts as safe depends on whether the PHP user owns the file.

Why does file ownership matter as much as the number?

Permissions only mean something relative to the account that owns the file. The handbook says that on shared hosts, “files should never be owned by the webserver process itself.” Under suexec, all files should be owned by your actual user account, not the account used for the httpd process.

Six-step sequence for hardening wp-config.php
A layered approach to wp-config.php hardening.

This is also why plugin updates or media uploads can fail after a permissions change. The web server process may no longer have the access it needs. A forum contributor in the 2016 support thread noted that blanket permission changes had previously broken several of the asker’s sites (anecdotal). Change one item at a time and test, rather than running one recursive chmod across everything.

Is 777 ever safe for wp-content or uploads?

The handbook’s position is “Only use 777 if necessary.” That is a last resort, not a setting to try first. 777 lets any account on the server write to the folder.

The official pages are not fully consistent here. The File Permissions page uses 766 on wp-content in a recursive example and mentions 777 as a last resort, while the Hardening page gives no number. If uploads fail, check ownership before loosening permissions.

How do you harden wp-config.php beyond permissions?

Permissions are one layer. The Hardening page describes several others, and each has limits worth knowing.

Block direct web access

The handbook gives an Apache rule: a <Files “wp-config.php”> block containing “Require all denied.” This tells the web server to refuse direct requests for the file.

Consider moving the file

The handbook suggests moving wp-config.php one directory above the WordPress install. It also admits disagreement. Some say the move “has minimal security benefits” and, done carelessly, “may actually introduce serious vulnerabilities,” while others dispute that. Sucuri recommends the move without that caveat (vendor-reported).

Disable the dashboard code editor

Adding define( ‘DISALLOW_FILE_EDIT’, true ); is equivalent to removing the edit_themes, edit_plugins and edit_files capabilities from all users. The handbook says it “will not prevent an attacker from uploading malicious files” but “might stop some attacks.” A related constant, DISALLOW_FILE_MODS, blocks plugin and theme installation and update functionality, so it will stop updates from the dashboard as well.

What are WordPress security keys and salts?

WordPress security keys and salts are eight constants in wp-config.php: AUTH_KEY, SECURE_AUTH_KEY, LOGGED_IN_KEY, NONCE_KEY, AUTH_SALT, SECURE_AUTH_SALT, LOGGED_IN_SALT and NONCE_SALT. The official WordPress.org secret-key service generates all eight, and each value was 64 characters when we checked the live endpoint on November 19, 2026.

The wp-config-sample.php file in WordPress core says to change these to unique phrases and points to that service. It adds: “You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.” Sucuri also points to the WordPress.org generator, or the reset option in its own plugin (vendor-reported).

Should you rotate them regularly?

The official sources do not agree on this. The sample file says you can change them at any time. The Hardening page, in its See Also section, links an external article titled “How WordPress Uses Salts and Why You Should Not Rotate Them.” We do not summarize its argument here. A clear case for changing them is after a suspected compromise, since it ends every existing login session. For routine rotation, no official source gives a schedule.

What the evidence does not tell you

  • It does not give one agreed wp-config.php number. The official pages say 400 or 440, while vendors and forum users cite 600 and 644.
  • It does not show how often permissions or wp-config.php are involved in real compromises. We found no incidence data, so we cite none. For broader data, see our WordPress security statistics post.
  • It does not prove that permissions alone protect you. Sucuri’s 2016 post (vendor-reported, and older than 18 months) says a 400 permission gives no protection against an arbitrary file download vulnerability. The web server process must read the file, and the exploit makes that process return its contents.
  • It does not explain what each key and salt does in detail. The only official wording we confirmed is the comment in wp-config-sample.php.

Permissions reduce what a compromised account or process can write. They do not replace updates, strong credentials and scanning. Our post on whether a security plugin alone stops attacks covers why single measures fall short.

Where to get help with WordPress file permissions

Atgler has worked with WordPress for 7 years and has built, managed and maintained more than 600 sites. Permissions are one item in our website care and maintenance work, alongside weekly updates and uptime monitoring. If a site has already been compromised, our hacked site repair service handles cleanup, and our guide to finding and removing a WordPress backdoor explains what that involves.

Our guide to choosing the best security plugin for WordPress covers free and paid options.

Frequently asked questions

What are the correct permissions for WordPress files and folders?

The WordPress handbook gives 755 for folders and 644 for files. Under suexec on shared hosting it allows 750 and 640, and group-writable setups may need 775 and 664.

Should .htaccess be 644?

The handbook says 644 is normally required and recommended for .htaccess. If you want WordPress to write rewrite rules automatically, the file must stay writable by your user account.

Does DISALLOW_FILE_EDIT stop a hacker?

Not on its own. The handbook says it will not prevent an attacker from uploading malicious files, but it might stop some attacks by removing the dashboard code editors.

What happens to logged-in users when I change my salts?

All existing cookies are invalidated and every user has to log in again, according to the comment in wp-config-sample.php. Plan the change for a quiet time on sites with many logged-in users.

Will a blanket chmod across the whole site break it?

It can. A contributor on a WordPress.org support thread said blanket permission changes had broken several sites before (anecdotal). Change values in small steps and test uploads and updates after each one.

Sources