If you’ve ever managed a WordPress site, you might have run into an issue where plugins or themes couldn’t be installed, images couldn’t be uploaded to the media library, or files that you expected to be on the site just weren’t showing up properly.
At the heart of all these issues is the concept of file permissions, but if you’ve never managed a web server you might not be quite sure what file permissions are, how they work or how they get misconfigured in the first place.
In this article, we’ll take a look at everything you need to know about file permissions and how they work in WordPress.
We’ll examine some of the specific instances where you’re most likely to see file permission errors and investigate how you can diagnose these errors and debug them.
What are file permissions?
From the earliest multi-user computer system, file permissions have been needed to decide which users have access to which pieces of the filesystem.
For example, each user typically has a “home” folder, which they can access, but which other users on the system can not.
What allows this is a set of file permissions that fall into 3 categories:
- What permissions the owner has.
- What permissions the file group has.
- What permissions everyone has.
These permissions are usually expressed in one of two ways: as a number or as a string of characters. The file permissions that each of these numbers and characters represent are the same in both cases.
The way these permissions are set determines who can access a given file at any given time.
How are file permissions used in WordPress?
In most cases, the server that is running a WordPress site is running as a particular user.
Just like any user on the system, files owned by the web server user tend to be accessible to that user and thus accessible to the WordPress installation that the user is running.
This is important because for WordPress to run updates, allow users to upload media, install plugins and themes, and most everything that WordPress does to run, it needs permissions to access the various directories inside the WordPress installation.
If the system user that WordPress is running under doesn’t have access to write to the uploads directory, for example, anyone attempting to upload media inside the WordPress admin area will see an error message and not be able to add anything to the Media Library.
On the other hand,
[…]
This article was written by Keanan Koppenhaver and originally published on WP Mayor.