Skip to contentSkip to main navigation Skip to footer

How To Change File Permissions in WordPress

Why Are File Permissions Important in WordPress?

File permissions are a crucial aspect of website security. They determine who can access, modify, or delete files and directories on your server. Properly configured permissions help safeguard your WordPress site against unauthorized access and malicious activities. Here’s why they matter:

  1. Security: Incorrect permissions can expose sensitive files, making your site vulnerable to attacks. By setting appropriate permissions, you limit access to authorized users only.
  2. Protection Against Exploits: Some plugins, themes, or poorly coded scripts may have vulnerabilities. Proper permissions prevent these from being exploited by malicious actors.
  3. Data Integrity: Correct permissions ensure that critical files (such as configuration files) remain unchanged. Unauthorized modifications could lead to site malfunction.
  4. User Isolation: Different users (e.g., web server, FTP user, WordPress admin) require varying levels of access. Permissions allow you to isolate user roles effectively.

Changing File Permissions Using Plugin

Since Hide My WP Ghost 7.3 fixing file permission is one click away. When you run a Security Check in Hide My WP Ghost, if there are any file permission issues, you have the option to fix them right away.

Click to fix it and select if you want a complete fix of all directories, files and config files or just the main directories.

The default permissions chmod are:

  • Directories – 0755
  • Files – 0644
  • Config Files – 0444

After the fix, run the security check again and make sure all security tasks are completed.


Changing File Permissions Using FTP

FTP (File Transfer Protocol) is a widely used method for managing files on a web server. Follow these steps to adjust file permissions using an FTP client (e.g., FileZilla):

  1. Connect to Your WordPress Site:
    • Open your FTP client (e.g., FileZilla).
    • Enter your FTP server details (usually provided by your hosting provider).
    • Navigate to your WordPress installation directory.
  2. Set Folder Permissions:
    • Right-click your WordPress folder and select “File permissions.”
    • Set the numeric value to 755 for folders.
    • Ensure the “Recurse into subdirectories” box is checked.
    • Click OK to apply the changes.
  3. Adjust File Permissions:
    • Locate your index.php file within the WordPress folder.
    • Right-click the file and select “File permissions.”
    • Set the numeric value to 644 for files.
    • Click OK.
  4. Repeat for Other Files and Folders:
    • Apply similar permissions to other files and directories as needed.

Changing File Permissions Using cPanel File Manager

If your hosting uses cPanel, you can also modify permissions directly through the cPanel File Manager:

  1. Log in to cPanel:
    • Access your cPanel dashboard via your hosting account.
    • Navigate to the File Manager.
  2. Select Your WordPress Folder:
    • Right-click your WordPress folder and choose “Change Permissions.”
    • Set the permission value to 755.
  3. Modify Individual Files:
    • Double-click your WordPress folder to explore its contents.
    • Locate the index.php file.
    • Right-click it and select “Change Permissions.”
    • Set the permission value to 644.

Best Practices for File Permissions in WordPress

  • Folders: Set to 755 (read, write, execute for owner; read and execute for group and others).
  • Files: Set to 644 (read and write for owner; read-only for group and others).

Remember to test your site thoroughly after making changes to ensure everything functions as expected. Regularly review and update permissions to maintain security. If you encounter any issues, seek assistance from your hosting provider or WordPress community.

By following these guidelines, you’ll enhance your WordPress site’s security and protect it from potential threats. 🛡️🔒


Customize Permissions

You can easily customize the file permissions that Hide My WP Ghost sets by adding a simple definition to your wp-config.php file.

Use the following code snippet:

define( 'HMW_FILE_PERMISSION', 0640); 

This code modifies the default file permissions from 0644 to 0640. You can adjust the value 0640 to any permission level that suits your needs. Just place this code in your wp-config.php file, and it will automatically apply your custom settings.

To change the directory permissions:

define( 'HMW_DIR_PERMISSION', 0750);

This code modifies the default dir permissions from 0755 to 0750. You can adjust the value 0750 to any permission level that suits your needs. Just place this code in your wp-config.php file, and it will automatically apply your custom settings.