Here’s a quick and dirty example to demonstrate Linux file permissions and how to read them.
Linux permissions are displayed in 10 characters, like this:
drwxrwxrwx
The first character is the type of resource. Here are 3 common types you might encounter.
File | f |
Directory | d |
Link | l |
The last nine are really groups of three.
User | Group | Other |
---|---|---|
rwx | rwx | rwx |
rwx
have integers attached to them.
Letter | Function | Value |
---|---|---|
r | Read | 4 |
w | Write | 2 |
x | Execute | 1 |
How it adds up
rwx = 7 | because | 4 + 2 + 1 = 7 |
rw- = 6 | because | 4 + 2 = 6 |
r-x = 5 | because | 4 + 1 = 5 |
Full Example:
drwxr-xr-x
Type | User | Group | Other |
---|---|---|---|
d | rwx | r-x | r-x |
7 | 5 | 5 |
Done!
– masterkenneth