11 File Permissions Cheat Sheet
11 File Permissions Cheat Sheet
11 File Permissions Cheat Sheet
Permissions
Permissions on Unix and other systems like it are split into three classes:
User
Group
Other
If a user is not the owner, nor a member of the group, then they are classified as other.
Changing permissions
In order to change permissions, we need to first understand the two notations of permissions.
1. Symbolic notation
2. Octal notation
Symbolic notation
Symbolic notation is what you'd see on the left-hand side if you ran a command like ls -l in a terminal.
The first character in symbolic notation indicates the file type and isn't related to permissions in any way. The
remaining characters are in sets of three, each representing a class of permissions.
The first class is the user class. The second class is the group class. The third class is the other class.
Each of the three characters for a class represents the read, write and execute permissions.
Octal notation
Octal (base-8) notation consists of at least 3 digits (sometimes 4, the left-most digit, which represents the setuid
bit, the setgid bit, and the sticky bit).
Each of the three right-most digits are the sum of its component bits in the binary numeral system.
For example:
So what number would you use if you wanted to set a permission to read and write? 4 + 2 = 6.
Symbolic
Octal notation Plain English
notation
-rwxr--r-- 0744 user class can read/write/execute; group class can read; other class can read
-rw-rw-r-- 0664 user class can read/write; group class can read/write; other class can read
Let's use the examples from the symbolic notation section and show how it'd convert to octal notation
CHMOD commands
Now that we have a better understanding of permissions and what all of these letters and numbers mean, let's take
Permission
(symbolic CHMOD command Description
nocation)
-rwxrwxrwx chmod 0777 filename; chmod -R 0777 dir All classes can read/write/execute
-rw-r--r-- chmod 0644 filename; chmod -R 0644 dir user class can read/write; all others can read
-rw-rw-rw- chmod 0666 filename' chmod -R 0666 dir All classes can read/write
a look at how we can use the chmod command in our terminal to change permissions to anything we'd like!
These are just some examples. Using your new-found knowledge, you can set any permissions you'd like! Just be
careful and make sure you don't break your system.