How to change file permissions?

Setting file permissions in WordPress is a crucial but frequently forgotten chore. On your server, they control who has access to read, write, and execute files. For your website to function properly and securely in WordPress, they must be properly specified.

Through the command line, WordPress users can modify file permissions. If you have access to your server and want to quickly change them for numerous files or folders, use this method.

What are the file permissions?

The default file permissions for a WordPress installation should be set to ensure maximum security, and the recommended file values are usually set as follows:

  • Root directory (/): 755
    • /wp-admin/: 755
    • /wp-includes/: 755
    • /wp-content/: 755
      • /wp-content/themes/: 755
      • /wp-content/plugins/: 755
      • /wp-content/uploads/: 755
    • .htaccess: 644
    • index.php: 644
    • wp-config.php: 640

These settings provide the necessary read and write access for the server and web server process, while restricting write access for other users. Some plugins and themes may require different permissions for specific files, but it’s important to ensure that sensitive files such as wp-config.php are set to read-only (640) to prevent unauthorized access.

It’s important to note that file permissions can vary depending on the server environment and hosting setup, so it’s best to consult with your hosting provider or a WordPress expert if you’re unsure about the proper settings for your site.


There are several ways to change WordPress file permissions:

  1. Via File Manager in cPanel:  Simply log in to cPanel, navigate to File Manager, locate the file or directory you want to change permissions for, right-click on it and select “Change Permissions.” Then, set the desired permissions using the checkboxes or numeric value.

  2. Via FTP or SFTP client: You can use a client, such as FileZilla, to connect to your WordPress site and change file values. Locate the file or directory you want to change permissions for, right-click on it, and select “File permissions.” Then, set the desired values using numeric only.

  3. Via the Command Line (SSH): If you have SSH access to your server, you can change file permissions using the command line. Connect to your server using an SSH client, navigate to the WordPress directory, and use the chmod command to change them.

For example, to set the permissions of the wp-config.php file to 640, use the following command:

					chmod 640 wp-config.php

To set the permissions of the wp-content directory to 755, use the following command:

					chmod 755 wp-content
  • Step 4: Verify file permissions. After setting them, it’s important to verify that the permissions were set correctly. To do this, use the ls -l command to view the permissions of the files or directories you modified.

To view the permissions of the wp-config.php file, you would use the following command:

					ls -l wp-config.php

The output should show the permissions of the file in the following format:

					-rw-r--r-- 1 user group 2810 Apr 15 2023 wp-config.php

The first column represents the file permissions, followed by the owner and group of the file, the file size ( in bytes ), and the date the file was modified.


In conclusion, using the command line to adjust file permissions in WordPress is a quick and effective way to make sure that your website functions properly and is secure.

You can quickly adjust file permissions for your WordPress installation by following these instructions, and you can also check to see if the rights were set correctly. Be cautious when changing permissions, as improper settings can break your site or leave it vulnerable to security exploits.

Share This

Please Donate

If my how-to tutorials helped you, please consider making a donation. ☕ ☕


Need affordable cPanel hosting?

Leave a Reply

Your email address will not be published. Required fields are marked *