Changing File Permissions

How to Change the WordPress File Permissions in cPanel or FTP

In WordPress Security by Fathi Arfaoui0 CommentsLast Updated: April 13th, 2018

Want to change the WordPress file permissions? And you found a problem and you need to fix it with that file edit? So, keep reading, I’ll show you how to update the file permissions easily using cPanel or FTP.

Sometimes, things seem complicated when you are a newbie to any domain, especially, the WordPress world. One of the biggest problems that bloggers find is how to change WordPress file permissions. It’s not easy if you’ve just started with your blog, and terms like Linux permissions, looks like from another world.

Don’t worry, every blogger, even, the most popular webmasters forget that one day. They were unable to do things easier than changing the file permissions. However, most of them forget to help others who need the help in a step by step guide.

In this post, you will learn how to change the WordPress file permissions in easy steps, and you will be able to help others.

The main reasons to open your WordPress files and edit permissions is when you can’t upload images, get the white screen of death. Or in other cases to set up and correct some issues in your blog. Before starting, it is better to know that every file in your blog has its own permissions setting.

This is a safe method to secure your site and never allow people and scripts from the outside of your blog to edit and change files and especially PHP files.

Changing WordPress file permissions

Edit the file permission using cPanel

Every web hosting company has a file editor option or similar function to let you view, edit, and update your Blog files. All you have to do is to log into your cPanel account. It’s the software that lets you manage your Blog files, and your login details are sent the first time when you signed up for a web hosting account.

How to Change WordPress file Permissions

In your cPanel dashboard, you have too many icons and settings, just find the ”Legacy File Manager” icon as the screenshot below:

cPanel File Manager

As you can see there is another “File Manager” icon, but I highly recommend the second one with the green arrow. The reason is that, with that legacy file manager, you are guaranteed to edit and change the file permissions.

The problem that we’ve found with the first one is that you can change the file permissions. But when saving the file, the change will back to the old settings. So, you see the changes, but when you refresh the page it turns back. Please note that this issue is special for some server settings that you can’t see. So, use the legacy file manager, as above and avoid problems, it is easy and fast.

If you’re using a modern cPanel version, you’ll get all your website file in a new window. That’s easy and fast.

file editor

On the other side, with old versions of cPanel file manager, when clicking on Legacy File Manager, a pop-up window will be opened, select the “Documents Root” option and you need to check the “Show Hidden Files (dotfiles) box as this example.

open the file editor in cPanel

After clicking the “Go” button, you can see all your WordPress and Blog files in the next window.

Let’s suppose that we’re going to change the ”Uploads” WordPress directory permissions, which is a common issue in. Sometimes, you get an error with permissions messages caused by the ”Uploader” wrong settings.

The file “Uploads” is located in the “wp-content” which itself located in the public HTML files. So, find the “wp-content” file first as the next example.

open files directory

As in the screenshot, you need to click the small file icon at the left of any file that you need to open. Then, find any subfile you want to edit, in this case, we want to edit the “Uploads” file. Click the wp-content icon and you get the next window.

how to find the Uploads file in WordPress

Now, you will get the new window on the same page, find “Change permissions” and click on it as the following screenshot.

Change a single file permissions

When clicking “change permissions”, you get this window example.

check file permissions

Finally, you have the option to check and change permissions on a file as yo wants. Check all boxes to get the 777 file permissions, this means Read, Write and Execute for all. Then, save the change. This is an example of a problem with the “uploads” file, you need also to open the month file and change its permissions to 777. Don’t forget to change back your file permissions to 755 to secure it.

Please note that if you still have any problem with file permission. The solution is setting 777 for both the wp-content folder and the subfolder (uploads in our case) and even more. You have to open the upload file and set 777 for your actual months.

This is the logical WordPress file permissions if you set 777 for a subfolder, but, the parent folder is 755. So, you need to set the parent as 777 also and change it back to 755 when the problem solved.

Change your WordPress file permissions through Command Line

The above method is the easiest and the safest as you can change it back easily and modify and test n real time. However, if you know how to use SSH; Shell and your web hosting account allow SSH, then, it’s also fie to change the Blog file permissions using Command Line.

So, to change a single file permission in WordPress, login to your terminal and use the folwing code:

sudo chmod 644 <file-name>

And change the file name with the exact location of the file you want to edit. Here are some other examples, try each one of them as WordPress may not work with all the server file permission depending on your hosting company.

chmod -v 746 DIR-NAME

chmod -v 747 DIR-NAME

chmod -v 756 DIR-NAME

chmod -v 757 DIR-NAME

chmod -v 764 DIR-NAME

chmod -v 765 DIR-NAME

chmod -v 766 DIR-NAME

chmod -v 767 DIR-NAME

Change the DIR-NAME  the exact folder like wp-content/themes/example. If all that fails to fix the problem for your website, then, you can change the -v with -R and that will update the permissions for all the files in the folder.

And finally, as WordPress recommends, you can try 777 for permissions, and that may fix your blog issues. But make sure to change them back to default for security reasons.

Now, you just learned how to change WordPress file permissions, but, with an easy method through cPanel. It’s easier than using the FTP method, and best of all it’s popular, and the majority of the modern web hosting providers have a file editor option.

If you still need to use your favorite FTP software, then, read use Filezilla with WordPress. You can edit files and download or uploads them easily.

Note about changing file permissions in WordPress

That way, changing file permissions is easier, but only, if you got an error and you should change them. Another important thing to keep in mind is that you shouldn’t set 777 permissions for the following directories and files in WordPress:

  1. wp-admin
  2. wp-content
  3. wp-includes
  4. htaccess

You can edit them if you need, but only for moments and not let them open to the world with 777 file permissions. That’s a critical security problem and you have to change them back after fixing the problem, and take care of your Blog files and security.

If you want to add something about changing the WordPress file permissions, make sure you use the comment section below. Or use the contact page if you have useful tools and you want to recommend for bloggers and website owners.

I’m a WordPress expert with over 6 years of experience in solving problems with themes, plugins, code, and structure. Let e help you fix your blog or website issues through tutorials or contact me directly.

Leave a Comment