WP Tango

WordPress File Permissions That Keep Sites Safe

Fix WordPress file permissions without breaking updates or security. Learn safe chmod values, ownership rules, diagnostics, and recovery steps for servers.

November 26, 2026
WordPress File Permissions That Keep Sites Safe

WordPress file permissions should usually be 755 for directories and 644 for files, with `wp-config.php` tightened to 640 or 600 when the server setup supports it. But chmod values alone do not fix most permission errors. The critical detail is ownership: your PHP process must be able to read WordPress files and write only where WordPress legitimately needs to write, such as `wp-content/uploads`, cache directories, and update locations.

A site set to 777 may appear to work, but it removes a meaningful security boundary. A site set too tightly may throw 403 errors, fail plugin updates, or ask for FTP credentials. The correct configuration depends on how PHP runs on the server, who owns the files, and whether your host uses PHP-FPM, suEXEC, containers, or a shared web user.

The safe WordPress file permissions baseline

For the majority of properly configured WordPress servers, start here:

LocationTypical permissionWhy
WordPress directories755Owner can write; web process can traverse and read
WordPress files644Owner can write; server can read
wp-config.php640 or 600Limits exposure of database credentials
wp-content/uploads directories755Allows media uploads when ownership is correct
Cache directories755 or 775May need group write access on some stacks

These are defaults, not magic numbers. A PHP-FPM pool running under your site account often works cleanly with 755 directories and 644 files. A server where PHP runs under a shared group may require group-write permissions, commonly 775 on specific writable directories. That is a hosting configuration issue to understand, not a reason to make the whole WordPress installation writable by everyone.

Why WordPress file permissions fail

Unix permissions have three parts: owner, group, and others. In `644`, the first digit gives the owner read and write access. The second and third digits allow the group and everyone else to read the file. In `755`, the owner can read, write, and enter a directory, while group and others can read and enter it.

Directories need the execute bit to be accessed. That point causes frequent confusion. A directory set to `644` can look readable but cannot be traversed by the web server, which leads to broken assets, 403 errors, or WordPress failures that appear unrelated to permissions.

Ownership is equally important. If files belong to `root`, but PHP runs as your site user, WordPress cannot update plugins or create uploaded media even if the mode is 755 or 775. Conversely, if every site on a shared server writes as the same web user, loose permissions can expose one site to another compromised account.

Common causes include a migration performed as root, restoring a backup with the wrong owner, extracting an archive through SSH, copying files between accounts, or a plugin creating a cache folder with restrictive permissions.

Check ownership before changing chmod

Connect over SSH and inspect the WordPress root:

bash
ls -la

The output will show the owner and group beside each file. Then inspect the content directory and its writable locations:

bash
ls -ld wp-content wp-content/uploads wp-content/cache

If your account is `siteuser` but the files show `root root`, fix ownership before changing modes. On a server where your account should own the site files, the pattern is typically:

bash
sudo chown -R siteuser:siteuser /path/to/wordpress

Do not copy that command blindly on managed hosting or shared infrastructure. The expected group might be a web-server group, and recursively changing ownership can interfere with deployment processes, ACLs, or isolation policies. Ask your host which user PHP-FPM runs as and what ownership model it expects.

A reliable managed platform should make this boring. PHP should run under an isolated site user, uploads should be writable without 777, and routine WordPress updates should not require FTP credentials.

How to reset WordPress file permissions safely

Once ownership is correct, reset standard directory and file modes separately. From the WordPress document root:

bash
find . -type d -exec chmod 755 {} \; find . -type f -exec chmod 644 {} \; chmod 640 wp-config.php

This is safer than applying one recursive chmod value to everything. Applying 755 to files makes scripts executable when they do not need to be. Applying 644 to directories removes the execute bit WordPress and the web server need to access them.

Afterward, test the actions that matter: upload an image, install a small plugin on staging, update an existing plugin, save a permalink setting, and clear the site cache. Check the server error log if any operation fails. A permission problem usually leaves a direct message such as `Permission denied`, `mkdir() failed`, or `failed to open stream`.

Handle writable directories narrowly

Some plugins need directories under `wp-content` for caches, generated CSS, backup archives, or image optimization. Grant access to that directory only. Do not loosen permissions on WordPress core, `wp-admin`, or the entire `wp-content` tree because one cache plugin cannot write its own folder.

For example, if a cache folder requires group write access on a server with a shared group model, this may be appropriate:

bash
chmod 775 wp-content/cache

That does not mean every directory should become 775. More write access means more potential damage if a vulnerable plugin or stolen account is exploited. Keep the writable surface area as small as possible.

Protect wp-config.php without breaking WordPress

`wp-config.php` contains database credentials, authentication salts, and often custom environment settings. It should never be world-writable. On an account-isolated PHP-FPM setup, `600` is often appropriate because only the file owner needs access:

bash
chmod 600 wp-config.php

On setups where PHP reads files through a necessary group, use `640`. If changing this file causes a 500 error, restore the previous mode and verify the actual PHP-FPM user and group instead of guessing.

You can also move `wp-config.php` one directory above the WordPress document root. WordPress will look for it there automatically. This adds protection against accidental direct web exposure, but it is not a substitute for correct server rules, file ownership, backups, and timely updates.

Do not use 777 as a WordPress fix

`777` allows the owner, group, and every other local user to read, write, and execute. It is commonly suggested by outdated tutorials because it can make an upload or update error disappear immediately. That is not a repair. It is evidence that ownership or the PHP execution model is wrong.

On a poorly isolated server, 777 can let another compromised account modify your site files. An attacker may add spam pages, inject credit-card skimmers into WooCommerce templates, create administrator accounts, or hide malware in writable plugin directories. Even on isolated hosting, it creates unnecessary risk and makes future troubleshooting harder.

If WordPress only works at 777, collect the failed operation, affected path, owner, group, and PHP error-log entry. Those facts identify the real fault far faster than permission roulette.

Permission errors during plugin and theme updates

When WordPress requests FTP credentials during an update, it cannot write directly to the filesystem through PHP. The root cause is usually mismatched ownership or a restrictive server policy. Forcing `FS_METHOD` to `direct` in `wp-config.php` can mask the issue, but it does not grant PHP permission to write files.

Use that constant only when you know PHP already runs as the correct isolated account and WordPress is unnecessarily selecting FTP. On a server with incorrect ownership, forcing direct writes can produce failed updates or partially written plugin files. A partial update can take down a production site.

For agencies, test updates on staging first, snapshot or back up the site, and verify that the deployment user, PHP user, and file owner follow one deliberate model. Production updates should be routine maintenance, not an experiment performed while customers are checking out.

When permissions are not the real problem

A 403 error can come from NGINX or Apache rules, a web application firewall, ModSecurity, a malformed `.htaccess` file, or an object-storage integration. A 500 error may be a PHP fatal error, exhausted memory, an incompatible extension, or a broken opcode cache. Do not reset permissions repeatedly when the log points elsewhere.

Likewise, slow uploads are rarely solved by chmod. Look at PHP upload limits, disk space, inode usage, PHP worker saturation, and image-processing load. Modern high-frequency infrastructure helps with CPU-bound image generation and admin requests, but it cannot compensate for a filesystem ownership model that prevents WordPress from writing files.

Treat permissions as part of site operations, not a one-time setup checkbox. Keep ownership consistent after migrations, limit write access to the directories that need it, and investigate the first permission error before a quick 777 workaround turns a minor deployment issue into a security incident.

Keep reading