How to Fix Folder and File Permissions in WordPress
The server’s folder and file permissions help with site security. If the permissions are too loose, they can be exploited by hackers. However, if the permissions are too strict, they can prevent legitimate admin actions, like installing themes.
This tutorial will show you a quick and easy way to fix folder and file permissions.
Explaining file permissions
There are 3 groups, self, group and public and three permissions you can give them: read, write and execute. Here’s what they mean:
- Self: That’s you. When you access your site with username and password, you’re connected as the user.
- Group: That’s you, too. And maybe others. If your site can be accessed with more than one username and password set, then those sets are also part of the group.
- Public: That’s everybody else. You want to be very careful about the permissions you give them.
- Read: the ability to read a file.
- Write: the ability to modify a file.
- Execute: the ability to execute a file.
There’s one final thing you need to know. Those permissions are sometimes given numbers:
- Read: 4
- Write: 2
- Execute: 1
They are also added up. So, if the “Self” has permissions of 7, that means they can Read, Write and Execute. If “Public” has permissions of 4, they can only Read.
WordPress and file and folder permissions
To find out more a how file and folder permissions impact WordPress, click here to read the permissions documentation on WordPress.org.
Fixing WordPress permissions
- Use our Install Plugins tutorial to install and enable the All In One WP Security & Firewall plugin.
- In the left menu, hover over “WP Security”.
- Select the “Filesystem Security” menu item.
- You’ll get a list of critical files and folders that it checks the permissions for.
- You can use the “Set Recommend Permissions” button to change it to the plugin’s recommendations.
Pro tip: How to recursively modify all your folders and files
As you may have noticed, the above method only corrects some of the folders and files. This next process will show you how to cycle through all your folder and files and fix their permissions.
- Get FileZilla and log into your site.
- In the remote site (right side), right click on the folder (including its sub items) that you’d like to change.
- Select “File Attributes”.
- Select the “Recurse into subdirectories” option.
- If you’ve set 755 for the permissions, apply it to directories only.
- Then use 644 for files only.
- Each time, FileZilla will navigate through the folder and its subfolders changing the permission of each item appropriately. It may take several minutes for it to complete if you have many files.
- Afterward, double check the permissions of some of the items, particularly for the main folder.
Great Post . really Helpful for Me. Thanks for Sharing.
Great plugin, it just does not work for me unfortunately. I can not change the file permissions with the “Set Recommend Permissions” button. Nothing happens. Do you know how to fix this?
Yeah, great plugin, unfortunately I couldn’t get it to work either, ended up using shell access to sudo chmod 777 the file I had permission errors with. It’s not an ideal solution as far as security but it was the only way I was able to change acesss.
Hi Nick,
I was trying to update the Elementor and Ocean Extra plugins on my latest WP 4.8.3 after a manual upgrade from previous version. Both the updates failed with file permission error statements. I have installed All in One …plugin today. However it fails to work with my wp-admin as it detects the current permission wrongly for all my files/folders . This was cross checked by me directly by logging on my web hosting account and checking the various file and folder permissions and comparing with the current permission listing. I can attach a screenshot if there was a provision. The plugin was also unable set the permissions to the recommended permission.Any advise will be valuable.
Cavthis lock in the permissions in the index. Permissions constantly changing in index from 0644 to 0666 …neee to find a way to lock permissions.
Thank you! Knew I had a file permissions error somewhere, following a change of host, but couldn’t find it. Installed this plug in and found it in 10 seconds!
Thanks for the post, but I can not find “filesystem security” after activating the plugin, is there something wrong with my installation?
i do not understand red block in filesystem security box in wp-content/themes at this point
I installed and activated this WP Security plugin on our WP deployment (w the Avada Theme and hosted on Google Cloud).
There was most clearly an issue with the permissions on the wp-content directory. It was the only one showing up RED. When I pressed the “Set Recommended Permissions” button I got this response from the application:
“Unable to change permissions for /opt/bitnami/apps/wordpress/htdocs/wp-config.php!”
This tells me very little. Anyone know WHY this process failed?
Thanks for creating this wonderful content, I have found your content very helpful.
I am using your plug in with the latest wordpress and all the permissions are yellow even though it they are the same as the recommended and I not change any of them.
@Nick – can you help for mac for the same scenario? I have had tried diskutil resetUserPermissions / `id -u` and it’s running for 12+ hours but without success.
Anubhav
This is no longer relevant