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