Introduction
Imagine your WordPress website as a house. You have different rooms, valuable items, and various entry points. Just like you wouldn’t leave all your doors and windows unlocked, or give every visitor a key to every room, your website’s files and folders need proper protection. This protection comes in the form of file permissions.
File permissions are a fundamental aspect of website security. They control who can read, write, or execute (run) the files and folders on your server. Incorrect permissions are a common vulnerability that hackers exploit to gain unauthorized access, inject malicious code, or even take complete control of your site. A single misconfigured permission can be the weak link that compromises your entire WordPress installation.
This guide will explain everything you need to know about WordPress file permissions. We’ll demystify the numbers (like 755 and 644), explain why they’re crucial for security, and provide step-by-step instructions on how to set them correctly. By understanding and implementing these best practices, you’ll significantly strengthen your WordPress site’s defenses and keep your valuable data secure.

Understanding File Permissions (CHMOD)
File permissions are often represented by a three-digit number, like 755 or 644. This number is a shorthand for specifying who can do what with a file or folder. Let’s break it down:
Each digit in the three-digit number represents a different category of user:
- First Digit: Owner (You, the website owner or your hosting account)
- Second Digit: Group (Users who are part of a specific group, often your web server processes)
- Third Digit: Others (Everyone else on the internet)
For each of these user categories, you can grant or deny three types of access:
- Read (4): Allows viewing the contents of a file or listing the contents of a directory.
- Write (2): Allows modifying the contents of a file or adding/deleting files in a directory.
- Execute (1): Allows running a file (like a script) or accessing a directory.
To get the three-digit number, you add up the values for the permissions you want to grant for each category. For example:
7(Read + Write + Execute = 4 + 2 + 1) means full access.6(Read + Write = 4 + 2) means read and write access, but not execute.5(Read + Execute = 4 + 1) means read and execute access, but not write.4(Read = 4) means only read access.
Why Incorrect Permissions are a Security Risk
Setting file permissions incorrectly can open your site to serious security vulnerabilities:
- Too Permissive (e.g.,
777): If you set permissions to777for a file or folder, it means everyone (owner, group, and others) has full read, write, and execute access. This is extremely dangerous! It allows hackers to easily inject malicious code, upload harmful files, or modify your website’s content without any authentication. It’s like leaving your house door wide open for anyone to walk in and do whatever they want. - Too Restrictive: While less common, setting permissions too restrictively can break your site’s functionality. For example, if your web server doesn’t have read access to your WordPress files, your site won’t load. If it doesn’t have write access to the
wp-content/uploadsfolder, you won’t be able to upload images.
The goal is to find the right balance: grant just enough permission for your site to function, but no more.
WordPress File Permissions Best Practices
Here are the generally accepted and recommended file permissions for a secure WordPress installation:
1. Files
- Recommended:
644 - Explanation: This means the owner (you) can read and write files, the group (web server) can only read them, and others (everyone else) can only read them. This prevents unauthorized users from modifying your core WordPress files, themes, or plugins.
- Examples:
index.php,wp-login.php,wp-activate.php,wp-settings.php, and all other.phpfiles. - Extra Security: For highly sensitive files, some experts recommend
640or604where the group has no read access or others have no read access respectively. However,644is the common and safe default.
2. Folders
- Recommended:
755 - Explanation: This means the owner (you) has full read, write, and execute access (needed to create/delete files within the folder), the group (web server) can read and execute (needed to navigate into the folder and read its contents), and others can only read and execute. This allows your web server to serve files from these directories while preventing unauthorized modifications.
- Examples:
wp-admin,wp-includes,wp-content,wp-content/themes,wp-content/plugins,wp-content/uploads. - Note for
wp-content/uploads: This folder often needs755to allow WordPress to upload new media files. If you experience issues uploading, temporarily try775(owner and group have full access) and then revert to755if it fixes the issue, or consult your hosting provider.
3. wp-config.php
- Special Case: This file is arguably the most important file in your WordPress installation. It contains your database credentials, security keys, and other critical configuration settings. It should be highly protected.
- Recommended:
640or600for maximum security.640: Owner can read/write, group can read, others have no access. The web server (often part of the group) can read it.600: Only the owner can read/write, group and others have no access. This is the most restrictive and often preferred if your web server can still read it (which it usually can if it’s the owner or part of the owner’s group).
- Why it’s crucial to protect this file: If a hacker gains access to
wp-config.php, they can get your database username and password, which gives them complete control over your website’s data.
How to Change File Permissions
There are a few common ways to change file permissions:
1. Using an FTP Client (e.g., FileZilla)
This is the most common method for many WordPress users.
- Connect to your server: Use an FTP client to connect to your website’s hosting server using your FTP credentials.
- Navigate to your WordPress installation: Go to the root directory of your WordPress site (where you see
wp-admin,wp-content,wp-includes, etc.). - Select files/folders: Right-click on the file or folder you want to change permissions for.
- **Choose
“File Permissions” or “Change Permissions“.
- Enter the numeric value: In the dialog box, enter the recommended numeric value (e.g.,
755for folders,644for files,600forwp-config.php). - Apply to subdirectories (for folders): For folders, you usually want to apply permissions to subdirectories and their contents recursively. Be careful with this option and ensure you apply the correct permissions.
Step-by-step instructions with screenshots: (This would typically include visual aids in a live blog post).
2. Using Your Hosting Control Panel (cPanel, Plesk, etc.)
Most hosting providers offer a file manager within their control panel (like cPanel or Plesk). This often provides a graphical interface to change file permissions.
- Log in to your hosting control panel.
- Find the File Manager: Navigate to the “Files” section and open the “File Manager.”
- Locate your WordPress installation: Browse to your WordPress root directory.
- Right-click or select the file/folder: Choose the item you want to modify and look for an option like “Change Permissions” or “Chmod.”
- Set permissions: Enter the numeric value or check the boxes for read, write, and execute permissions for the owner, group, and others.
3. Using SSH (for advanced users)
If you have SSH access to your server, you can change permissions using command-line commands. This is fast and powerful but requires more technical knowledge.
- Connect via SSH: Use an SSH client to connect to your server.
- Navigate to your WordPress root directory:
cd /path/to/your/wordpress/installation - Change permissions:
- For files:
find . -type f -exec chmod 644 {} \;(This sets all files to 644) - For folders:
find . -type d -exec chmod 755 {} \;(This sets all folders to 755) - For
wp-config.php:chmod 600 wp-config.php
- For files:
Verifying File Permissions
After making changes, it’s essential to verify that the permissions are set correctly.
- How to check current permissions: You can use your FTP client or File Manager to view the current permissions. With SSH, you can use
ls -lto see permissions. - Tools or plugins that can help: Many WordPress security plugins, such as Wordfence Security or iThemes Security, include a “
Tools” or “Site Health” section that can scan your file permissions and alert you to any that are incorrectly set. This is a great way to perform a quick WordPress security audit.
Common Mistakes and Troubleshooting
- Site breaking after changing permissions: If your site stops working or you see errors after changing permissions, it’s likely you set them too restrictively. Revert to the recommended
644for files and755for folders, and specifically600forwp-config.php. - Permissions resetting: Sometimes, your hosting environment might automatically reset permissions. If this happens repeatedly, contact your hosting provider. It could be a server configuration issue.
- Cannot upload images or install plugins: This is a common sign that your
wp-content/uploadsfolder or other relevant directories have incorrect write permissions. Ensurewp-contentand its subfolders (especiallyuploads) are set to755.
Conclusion
Correct file permissions are a cornerstone of WordPress security. By diligently applying the recommended 644 for files, 755 for folders, and 600 for your critical wp-config.php file, you create a robust defense against many common hacking attempts. This simple yet powerful security measure prevents unauthorized access and manipulation of your website’s core files.
Always remember to back up your site before making any significant changes, and use the tools available (like FTP clients, hosting file managers, or security plugins) to manage and verify your permissions. A secure website is a well-maintained website, and proper file permissions are a key part of that maintenance. For more information on general server security, you can refer to resources like DigitalOcean’s server security guides.
Frequently Asked Questions (FAQs)
Q1: What are the best file permissions for WordPress?
The best file permissions for WordPress are generally 644 for files, 755 for folders, and 600 for the wp-config.php file. These settings provide the necessary access for your website to function while minimizing security risks by preventing unauthorized writing or execution.
Q2: What does 755 mean for folders and 644 for files?
755for folders means the owner has full read, write, and execute access; the group has read and execute access; and others have read and execute access. This allows the web server to access and list folder contents.644for files means the owner has read and write access; the group has read-only access; and others have read-only access. This prevents unauthorized modification of files.
Q3: Can incorrect file permissions lead to a hack?
Yes, absolutely. Incorrect file permissions, especially those that are too permissive (like 777), can be a major security vulnerability. They allow attackers to write malicious code into your files, upload harmful scripts, or modify your website’s content, leading to a compromised site.
Q4: How do I change file permissions in WordPress?
You can change file permissions using an FTP client (like FileZilla), your hosting control panel’s file manager, or via SSH commands if you have server access. In an FTP client, you typically right-click a file or folder, select “File Permissions,” and enter the numeric value or check the appropriate boxes.
Q5: Should wp-config.php have different permissions?
Yes, the wp-config.php file should have more restrictive permissions than other files. The recommended permission is 600 or 640. This is because it contains sensitive information like your database credentials, and restricting access to it is crucial for preventing unauthorized database access.