Correct file permissions for WordPress

Correct file permissions for WordPress

  1. Blog
  2. 15 November 2026
  3. 4 min read

Stefan Bogdanescu

Founder & Senior Architect

Correct file permissions for WordPress

Setting file permissions on a WordPress installation often feels like guessing, especially when community forums suggest conflicting advice ranging from the dangerously permissive 777 to restrictive setups that break core functionality. The truth lies in balancing two competing requirements: the web server needs write access to specific locations so WordPress can update its own files, while the owner of the site needs read/execute access to run PHP and serve content. You must avoid giving the web server unrestricted write access to the entire directory tree, which exposes your site to arbitrary file upload vulnerabilities.

The standard baseline for a secure yet functional installation is 755 (or rwxr-xr-x) for directories and 644 (or rw-r--r--) for files. This grants the owner full control, allows group members to read and execute, but denies access to others. However, WordPress has specific exceptions where the web server process itself must be able to write data. These are primarily found in the wp-content, wp-admin, and sometimes wp-includes directories depending on your version and theme/plugin architecture.

For the root folder storing all content, you should generally stick to 755. The web server does not need to modify files here unless you are using a specific caching plugin that writes directly to the root. If you attempt to set this directory to 777, an attacker who finds a vulnerability in your theme or plugin can upload a malicious script (like shell.php) to the root and gain full control of your server.

The wp-admin folder requires more nuance. It typically contains configuration files like admin-ajax.php and various cache directories. Historically, older versions of WordPress required these folders to be writable by the web server so that plugin updates could overwrite existing files during installation. Modern versions often use a separate update mechanism or require manual permission changes, but keeping wp-admin at 755 is generally safe as long as you handle the specific subdirectories correctly. If you are using a caching plugin like W3 Total Cache or WP Super Cache, you will likely need to set the cache subdirectories within wp-admin to 777 so the plugin can write the .htaccess rules and cached HTML files.

The wp-content directory is the most critical area for permissions. This folder houses your themes, plugins, uploads, and object caches. The standard practice here is 755 for the parent folder but 777 (or more securely, 775 if using a specific group) for the uploads, cache, and objects-cache subdirectories. You must ensure that the web server user (e.g., www-data on Ubuntu or apache on CentOS) has write access to these specific subfolders. If you set wp-content to 755 everywhere, your site will fail when trying to upload images or cache data, displaying "Permission denied" errors in the media library.

The wp-includes folder contains the core PHP files and libraries. This directory should almost always remain at 755. While some legacy tutorials suggest making this writable, doing so allows attackers to modify core PHP logic if they exploit a plugin vulnerability. Modern WordPress versions have deprecated the ability to overwrite core files via FTP; instead, they use a separate update process that renames old files and downloads new ones. Therefore, keeping wp-includes read-only for the web server is a significant security hardening measure without impacting functionality.

Regarding individual files, the default of 644 is correct for all PHP, CSS, JS, HTML, and image files. These are text-based assets that should never be executable by the shell (755) unless they are specifically designed to be scripts, which is rare in a static WordPress context. Setting a file to 777 is an immediate security red flag; it means any user on the server can execute or modify your code.

To apply these permissions efficiently, you can use commands like chmod -R 755 /path/to/wordpress for directories and chmod -R 644 /path/to/wordpress for files. However, be careful with recursive commands; you might need to target specific subdirectories individually. For example:

# Set wp-content/uploads to 777 for the web server user 'www-data'
sudo chmod -R 775 /var/www/html/wp-content/uploads
sudo chown -R www-data:www-data /var/www/html/wp-content/uploads

If you are on a managed host like LaravelCompany, these permission tweaks might be handled automatically or via their control panel tools, but understanding the underlying logic ensures you can troubleshoot issues if something breaks. Always test your site after changing permissions to ensure that image uploads and caching plugins function correctly before rolling back.

Our network