Linux File Permissions are read, write, and execute. Those are the three things you’ll see here, repeated three times, or if there’s nothing there, it’ll just be a ‘-‘. This is important, and I’m going to break this down even further. Basically, ‘r–‘ means read-only, ‘rw-‘ means read-write with no execute, and ‘rwx’ means read, write, and execute. Pretty simple.
Table of Contents

Right now, it kind of lays out what you see on each one, and I’m going to give you a real-world example of this as well. So, the ‘-‘ means it’s a file, ‘d’ means it’s a directory, and that’s the first thing here. You might also see ‘l’ on occasion for symbolic links, but I’m not going to cover that today.
Understanding Permissions

User and Group Information
The link count (1) indicates the number of hard links pointing to the file xmlrpc.php A hard link is essentially another name for the same file, and each file must have at least one hard link (itself). If the link count is greater than 1, it means there are additional hard links to this file.

The next two things many beginners notice will be the user and group, like ‘root developer1’. It’s not repeated twice; it assigns that one file to the user root and the group developer1. Then, there’s the file size, when it was modified, and the actual name of the file.
Real-World Example


Viewing Permissions with ls
I’m going to do ‘ls -l’ which gives us the long listing. ‘ls -l’ means long listing, and if you want to take it a step further and see all hidden files or directories (with dots before them), ‘ls -al’ shows everything.
Importance of Listing Commands
The user owner is on the left side, the middle three letters are for the group owner, and the final right letters are the permissions for others (guests and anonymous users). Just remember, ‘r’ for read, ‘w’ for write, and ‘x’ for execute. If there’s a ‘-‘, nothing is set for that specific one. These are important to know and should get you started with understanding actual permissions.
Changing Permissions

Introduction to chmod
Next, we need to get into changing the permissions. You’ve probably seen ‘chmod’ around before. This is important because you either do ‘chmod’ with a number behind it or with an actual letter. You can use either one, whichever works best for you. I like the number approach, but if you’re more creative, you might prefer the letters. If you can only remember letters, stick with them.
[root@ip-172-31-25-66 wordpress]# chmod 777 wp-mail.php
-rwxrwxrwx. 1 root root 8.4K Sep 16 2023 wp-mail.php
Let’s get into actual ‘chmod’ usage and understanding the numbers. Read counts as four points, write counts as two points, and execute counts as one point. So, if you want to assign read, write, and execute, that’s a seven. If you want to assign read and execute, that’s a five. If you want to assign read and write, four plus two equals six.
You can see the number layout here and what it all means. The ones you will always be using are five (read and execute), seven (read, write, and execute), and six (read and write). The numbers one, two, and three are rarely used because why would you execute a file you can’t read, write to a file you can’t read, or write and execute a file you can’t read?
Using chmod in Symbolic Mode
Using ‘chmod’ in symbolic mode allows you to assign permissions without using numbers. For example, ‘chmod 666’ assigns read and write privileges to the owner, the group, and others. ‘chmod 777’ assigns read, write, and execute to all three. If you prefer symbolic mode, you specify user (u), group (g), others (o) with + or – followed by ‘r’ for read, ‘w’ for write, or ‘x’ for execute. You can also remove permissions using a minus sign.
Preference for Numeric Mode
I find this more complicated, and I prefer using numbers. Memorizing the four numbers makes life easier.
Ownership
Introduction to chown
Let’s get into ownership next. You’ll often see commands like ‘chown userfile_or_folder_name’. It’s important to specify both user and group.
Changing Ownership
drwxr--r--. 9 root root 16K Jun 24 17:16 wp-admin
drwxr--r--.
indicates the directory has read, write, and execute permissions for the owner, and read permissions for the group and others.
The owner is root
, and the group is root
.
Changing Ownership
[root@ip-172-31-25-66 wordpress]# chown -R root:developer1 wp-admin/
-R
option is used to change ownership recursively for all files and directories within wp-admin
.
After executing the chown
command, the wp-admin
directory’s ownership is updated as follows:
drwxr--r--. 9 root developer1 16K Jun 24 17:16 wp-admin
Using sudo for Ownership Changes
You will always need ‘sudo’ for this. I’m going to switch to the root user to avoid typing ‘sudo’ each time. Clear the screen and ‘ll’. We’ve changed the ownership. Now, let’s change the permissions.
Changing Permissions with chmod
[root@ip-172-31-25-66 wordpress]# chmod 775 xmlrpc.php
-rwxrwxr-x. 1 root developer1 3.2K Mar 2 13:49 xmlrpc.php
[root@ip-172-31-25-66 wordpress]# chmod 774 wp-settings.php
-rwxrwxr--. 1 root root 28K Mar 2 10:47 wp-settings.php
Let’s say I want both user and group to read, write, and execute. I’ll use ‘chmod 775 xmlrpc.php‘. For read-only, it’s ‘chmod 774 wp-settings.php’.
This is just a quick breakdown of basic usage. You can easily change file permissions to allow specific users or groups to read, write, or execute.