Fix File and Folder Permissions WordPress

How to Edit File and Folder Permissions in WordPress

While WordPress is an incredibly stable platform, you will encounter errors from time to time. One of the common errors you can run into would be related to file permissions. Essentially, you are blocked from the file and must change the file permissions to fix it.

That said, sometimes you may just want to change the file permissions for better security practices. After all, only a site admin would need access to the majority of the files on their server. Regardless of the reason, changing your file permissions is quite simple.

Unfortunately, you cannot do this from within WordPress itself. Instead, you have two options. The first is to go through your cPanel to adjust file permission, while the second is to use an FTP client like FileZilla.

Today, I will go over how to change file permissions for your WordPress site using both methods.

How to Identify a File Permissions Error?

WordPress needs to access files on your server to update them as they become available or to save any changes you or your staff may make when creating or editing existing content.

During either of these processes, you may run into an error, but the problem is that WordPress doesn’t have permission to tell you. So, what happens is that nothing works and there are no explanations for why this is happening.

Naturally, this is infuriating, especially for beginners who have no idea this can even happen.

To put it simply, permission values for files need to be set to a specific value for WordPress to make changes. This value is different for folders and files. For folders, the value needs to be 755, while files need to be 644.

If file permissions were behind the problem, then once these changes are made, the problems should cease immediately.

Method 1: Using cPanel to Change File Permissions

The simplest way to access your files is through the cPanel’s File Manager. To access the cPanel, you simply need to log into your web hosting account.

The details to log in are provided by your web host. If you have trouble, don’t hesitate to contact them.

Step 1: Enter the File Manager

Begin by logging into your web hosting account. And access the cPanel.

cPanel

Once inside the cPanel, locate the Files section. Click on the File Manager option.

File Manager

Step 2: Choose a Folder or File

The File Manager allows you to see all of the folders and files on your web server. The process is identical for both, with the only difference being the value you have to input. As such, feel free to select any folder or file to change the permissions.

To do this, simply select the file or folder, right-click it, and select the Change Permissions option.

Change Permissions for File or Folder

Step 3: Set Permissions

The File Permissions window will now appear. The values I mentioned before, 755 and 644 cannot be entered manually. Instead, the numbers are decided by what permissions are given to the file.

There are three modes User, Group, and World. Each one of them has three options Read, Write, and Execute. Checking the boxes in each column will enable that function for that mode.

At the bottom are the numbers. Essentially, you want to get the values set to 755 which can only be done with the following configuration. No other combination will give you 755.

Change Permissions

To get 644 for a File, the combination looks like this:

Change File Permissions

You’ll want to do this for every file and folder within the public_html directory. You can select multiple folders or files by using the Shift key. This allows you to change permissions in bulk.

Note: Some web hosts may disable bulk selection, if so, individually is your only option when using the cPanel.

Once you do adjust the File Permissions, be sure to click the “Change Permissions” button.

Change Permissions

And that’s all there is to changing the file permissions from within the cPanel. As you can imagine, giving people access to the backend of your site can cause problems, thus only those who need it should have access.

Method 2: Using FileZilla to Change File Permissions

An alternative method to change the file permissions in WordPress is to use an FTP client like FileZilla. The main advantage of using FTP clients is that they have better tools for bulk selection.

Naturally, this makes it a great choice for anything that requires you to edit more than one file. If you need help setting up FileZilla, be sure to check out our full guide, as this tutorial will assume you already have your site connected to FileZilla.

Note: Other FTP clients can do the same, I am just selecting FileZilla due to its popularity.

Changing File permissions is extremely simple in FileZilla. There is a dedicated column that tells you what the current permissions are. Simply right-click any folder or file from your web server and select the File Permissions option.

File Permissions

This will open up a small box where you can change the file permissions. Unlike the cPanel, you can actually edit the value itself, thus for a Folder, enter 755, or for a file, enter 644.

Click the “OK” button to save.

Change File Permissions

And that’s it. Again, you can use the Shift key to select multiple files to make these changes in bulk. Unlike the cPanel, nothing can prevent you from doing this.

File Permissions FAQ

What if changing the file permissions did not solve the error?

If the problems persist, consider contacting your web host. An error on their end can be causing a problem. If this is the case, only they can fix it. If they don’t, you probably need to switch web hosts.

Are File Permissions the same as password protection?

No. Password protection only allows users with that password to access the file. File permissions, allow the systems to access the files. Adding a password to a file does not prevent WordPress from accessing it.

Are there any plugins that can change file permissions?

No. File permissions should be set by a site administrator from the backend of your site. If the file permissions were wrong, then the plugin would not even be able to work correctly, thus it is not practical to even make a plugin for this function.

Will other FTP clients allow me to change file permissions?

Yes. All FTP clients allow you to do this, and the process is very similar. FileZilla just happens to be the most popular option because it is free and easy to use.

How often should I change file permissions?

Realistically, you should only ever have to do it once. You may want to change file permissions for testing purposes, but this is better done on a testing environment and not on a live site.

Can someone else change your file permissions?

If your site is the victim of a cyber-attack, hackers can change the file permissions to cause damage and even disable security features. Sometimes, a backdoor corrupted file will change the permissions, thus, you need to quickly remove these files.

Do backups save your file permissions?

It depends on what you use for the backup, but generally speaking, yes, they do. If you do a full backup of your web server, the file permissions should be saved. As such, if you did recently change the permissions, updating your backup is a good idea.

What Do the File Permission Values Mean?

You may have been wondering why exactly 755 and 644 are the values you need to enter. To put it simply, these numbers represent if someone can read, write, or execute a file.

Reading a file means someone can see everything inside of it, writing a file means that person can edit the file, and executing the file, means someone can run that file. Naturally, you do not want people to be able to edit or execute it.

If this was the case, anyone could do anything with your website, and it would be a disaster. Instead, writing and executing files should be exclusively something only the website owner can do.

This brings us to the meaning of the values.

The 755 value for folders represents that the website owner can read, write, and execute folders. While the 644 value for files represents that only the website owner can read and write files, and everyone else can only read them.

Make Sure Your File Permissions Are Correct Today

As you can see, it is pretty easy to change file permissions in WordPress. That said, you really shouldn’t need to change them more than once, as once they are set, that’s the end of it.

The only time you may need to change file permission is if you add a new file or folder to your directory. That said, most permissions should be set automatically for you. Yet, there is no harm in taking an extra minute to check.

I hope you found this tutorial helpful for learning how to change file permissions for WordPress.

Did changing the file permissions fix an error? did you use the cPanel of FileZilla to change permissions?