It's so frustrating when you receive an error while updating your website. File and folder permissions error is one of the most common errors seen while running a WordPress website.
As you know, WordPress has its own set of files and folders stored on the web hosting you use. And to apply any kind of changes it's important that WordPress should have the proper privileges.
If the permissions are set wrong, you can't do anything on your website. There are different kinds of error messages you can receive.
Let's say you want to install a new plugin or a WordPress theme and when you try to upload or install it from the WordPress repository, you see an error "403 forbidden error" or "not eligible to do this task".
Depending on the task you want to accomplish, you see the different error messages. It directly signifies that the permissions you have set are wrong.
How are you going to fix this? Well, there are many ways you can adopt. You can use the FTP account, the cPanel or use a security plugin from your WordPress dashboard.
In this tutorial, I am going to walk you through the two different methods.
Fix the File and Folder Permission Error Using a Plugin
You should know that most of the security plugins allow you to accomplish this within a few minutes. For example, if you use All In One Security plugin, you can go to WP Security>>Filesystem Security and you will see the folder and file permissions.
You will see the current status of the permissions and the recommended permissions. The plugin can monitor all of the files and folders for you.
If any file or folder has the wrong file permission you just need to click on the "Set Recommended Permissions" button and it will automatically get fixed.
You should know that for files, the permission should be 644 and for the folders, it should be 755.
These permissions are calculated based on the three different options.
All the three users have the three different permissions.
Now, you may be wondering how the number 755 or 644 is decided. Let me explain this.
The permission to read has 4 numbers, write has 2 and execute has 1.
And if you select all, it becomes 7 for the User and if you choose to read and execute for the group, it becomes 5 and the same for the world.
If we combine the numbers, it becomes 755. The same process is applied to 644 file permissions.
Once you set the recommended permissions, you will see the correct permissions and you're all set. But many people don't like to use a plugin so I have another way.
Use the Web Hosting cPanel to Fix File and Folder Permission Error
As I have mentioned above, you can do that using an FTP account or directly by visiting your web hosting website. As you know, people aren't good with FTP so I am going to show the direct method.
Login to your cPanel account and open the file manager. You have to open the root directory of your website where the data of the website is located.
Most of the time, it's public_html or www. But if you're using a subdomain or an add-on domain, you may find it in your website's name folder.
Open it and you will see a few folders and many files. Select the folders and right-click on them. You will see the option to change permissions.
Depending on your web hosting's cPanel, the design may vary and even the options but you will find an option to change permissions.
As shown above, you can also change the permissions by selecting the folders and clicking on the "Permissions" link shown in the navigation menu of the cPanel.
Once you do that, a pop-up will appear showing you the current folder permissions. If you see 755, it's absolutely fine and you don't need to change them.
But if you see other folder permissions, you can select the boxes accordingly to make it 755 and save by clicking on "change permissions". At some web hostings, you may be asked an additional info. It will require choosing whether you're going to apply for folders or the files.
So here, we're talking about folders.
Once you do that, you need to hope up to files. As you can see there are multiple files available. You have to select them all just like you did for folders.
Make sure that you don't select any folder because if you do, you will be seeing the folder permissions, not file permissions.
So select all the files carefully and right-click to choose change permissions. You will see the similar popup showing file permissions.
If the number is 644, you don't need to change anything. But if it's not, you have to make it to 644. Just like before, click on the change permissions button and you're all set.
Try clearing the browser cache to install the plugin or the theme again. You will be able to do any changes on your website.
I Hope You Can Easily Change File and Folder Permissions Now
Due to the wrong file and folder permissions, you can also get an HTTP Error while uploading new images. And it's not just because any new plugin changes the permissions, sometimes, when your web hosting company tries to upgrade the server, the permissions get changed.
So whether you receive such error, you should check the permissions and I hope you know how to change them.
If you're a regular user of an FTP account, you can use the tools like FileZilla to access your website's data to set the correct permissions.
But most of the experts don't prefer to use FTP because it can be vulnerable. It's better to directly login to the cPanel and access everything.
If you still have any questions, feel free to drop a comment.