How to Fix Folder and File Permissions in WordPress

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

folder permissions explained

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

Filesystem security in the WP Security plugin

  • 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.

Set Recommend Permissions in the WP Security plugin


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”.

The "File Attributes" option in Filezilla

  • 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.

Changing owner permissions in Filezilla

  • 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.

Author

  • Nick Savov

    Nick is the Director of Support at OSTraining and you can find him in almost every area of the site, from answering support requests and account questions to creating tutorials and software.

0 0 votes
Article Rating
Subscribe
Notify of
13 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Free Link Submission Sites Lis
Free Link Submission Sites Lis
7 years ago

Great Post . really Helpful for Me. Thanks for Sharing.

wimPeNL
wimPeNL
6 years ago

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?

Shawn Williams
Shawn Williams
6 years ago

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.

Kaushik RoyChowdhury
Kaushik RoyChowdhury
6 years ago

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.

Adina
Adina
6 years ago

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.

Daisy
Daisy
5 years ago

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!

Samuel Lin
Samuel Lin
4 years ago

Thanks for the post, but I can not find “filesystem security” after activating the plugin, is there something wrong with my installation?

aman
aman
4 years ago

i do not understand red block in filesystem security box in wp-content/themes at this point

Dave Brown
Dave Brown
4 years ago

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?
 

Anekant
Anekant
4 years ago

Thanks for creating this wonderful content, I have found your content very helpful.

Jay Cohen
Jay Cohen
3 years ago

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. 

Anubhav
Anubhav
3 years ago

@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

jay
jay
3 years ago

This is no longer relevant 

13
0
Would love your thoughts, please comment.x
()
x