File and folder permissions in WordPress – .com

In this tutorial we will see what the file and folder permissions of a server are, what they are for, and how to modify them.

What is a server?

To understand each other, a server is a computer. What happens is that it is not the typical desktop or laptop, but rather a computer designed to store and manage data that we will later consult from other computers or terminals.

Specifically, today we are talking about web servers, which we hire from a CDmon or SiteGround-style hosting company.

Among other things (mail, domains, databases, etc) a hosting provider offers us a “hard drive” in which we host our website. And we can connect to it through an FTP program (File Transfer Protocol). More on this tutorial How to use an FTP program and How to use Coda.

Once we connect, we can see a list of folders and files as if they were on our computer. There we can upload all the files we want: Images, PDFs, Word files, music, videos… It doesn’t matter.

But in the case that we have WordPress installed, we will see something similar to this:

These files are the ones that we download from WordPress.org and upload manually by dragging them to our FTP program, or simply put them there by our hosting company, in the case that we have used a self-installation process.

You can see videos of both a procedure and another in the class of .

Permissions: what are they?

These files and folders have a special feature: They have permissions. And what are permissions? Well, it is about some attributes that they have, which will define who can read them, to write either execute them. Let’s see that there are three key things:

  • Read: They can see the content of the file. It is indicated by the letter (r), for “read”.
  • Write: They can edit, modify or delete the file. It is indicated by the letter (w), for “write”.
  • Run: If the file is executable, run it. It is indicated by the letter (x), for “eXecute”.
See also  Google Drive Course #6: Synchronization - .com

In other words, if we see that a file has “rwx” permissions, it means that it can be read, written and executed. When these permissions apply to folders (also called directories), it affects all the files that they contain. So that:

  • Read: The contents of the folder can be read.
  • Write: Files can be added or deleted within that folder.
  • Run: If commands can be executed inside the folder,

Now that we are clear about the types of permissions, let’s talk about another key point: The users, who are ultimately going to interact with the files.

Users: what are they?

It turns out that like permissions, we also have three types of users, although it has nothing to do with it. In this case, they are:

  • user: The owner of the file, which is the one who created it.
  • group: It is a group of users, which can be given specific permissions.
  • Others: The rest. Users who are neither the owner nor are they in a group.

It is important to understand that there are three levels of user, since we can then grant different permissions to different types of users.

Nomenclature

This is all very well, but things get complicated when we talk about the permissions nomenclature, since it is not very intuitive. If we check the permissions through the FTP client itself, we will see the following:

As we can see, a permission 644 appears. What the hell is that? Where do those numbers come from? What does it have to do with permissions?

See also  Create your own affiliate network with WooCommerce - .com

First of all, we must know that each permit is assigned a number:

  • read(r): 4
  • Write(w): two
  • run(x): 1

We are not going to get into the origin of this, because we should learn binary code, and it will not give us anything, that is, we will only keep those numbers.

The good thing about them is that we combine them how we combine them, together they tell us what permission is on a specific file. Here all the combinations:

  • 1: Run
  • 2: Write
  • 3: Execute + Write (1+2=3) (rare case)
  • 4: Read
  • 5: Write + Execute (2+3=5)
  • 6: Write + Read (2+4 = 6)
  • 7: Execute + Write + Read (1+2+4)

Let’s note that with a single number from 1 to 7, we already know what permission the file has. What has a 4? You can read. What has a 5? Write and run! Curious right?

the three digits

But of course, if this is the case, why are the permits always three-digit numbers? Well, the answer is by the types of users. The first digit refers to the Usernamethe second to clusterand the third at others. So, suppose a file has this number:

644

What does this mean? Very easy: 6 is the user’s permission. The first 4 the permission of the group, and the last 4 that of the others. Therefore:

  • 6: User can write and read (2+4)
  • 4: Group can only read (4)
  • 4: Others can only read (4)

Thus, with three digits, we are being told not only what permissions there are, but also what role we grant each of them.

Permissions in WordPress

So, and knowing how everything works, what are the recommended file permissions in WordPress? Well, although the answer, as always, is a big DEPENDS, what is recommended in most cases is 755 for folders and 644 for the files.

See also  How to add a website in Google Search Console - .com

It is true that we can be more restrictive to increase security, as we discussed in , you can take a look at it if you are interested in this topic.

Let’s note that this allows WordPress everything to work correctly, since you can read and execute files. But also, and this is very important, as the folders have 755, that means that they can be add, update and delete plugins and themes, that the owner (user) has permission 7, which allows reading, writing and executing.

When we do not have the permissions configured correctly, we can have the following problems:

  • Not being able to install plugins or themes
  • Not being able to update plugins or themes
  • Not being able to delete plugins or themes
  • Not being able to save permalinks

In short, everything that has to do with “modifying” something in the FTP files will give an error, because we do not have sufficient permissions. To fix it, you simply have to modify those numbers, save the changes, and live.

Summary and conclusion

File and folder permissions allow read, to write Y run files to users, groups Y others.

In WordPress it is recommended to have the files at 644 and the folders at 755. We can be more restrictive for security issues, but it can lead to problems when we want to work with files, plugins or themes.

And if you want to know more and better about WordPress and its good practices, and you will have access to . It’s worth it! 😉

Loading Facebook Comments ...
Loading Disqus Comments ...