Let’s take a look at our ls -l output and look the first column of the listing:
touch myfile
ls -l myfile
-rw-rw-r-- 1 hano hano 0 Apr 16 08:57 myfile
sudo chown hano.root myfile
ls -l myfile
-rw-rw-r-- 1 hano root 0 Apr 16 08:57 myfile
The you have 3 access value bits in this case rw- for the owner in this case hano then rw- for the group which corresponds to the root group and then all other users r–.
r | Read Access |
w | Write Access |
x | Execute Access |
To change the access use chmod (Change Mod)
chmod 754 myfile
ls -l myfile
-rwxr-xr-- 1 hano root 0 Apr 16 08:57 myfile
Mode | Decimal |
rwx | 7 |
rw- | 6 |
r-w | 5 |
r– | 4 |
-wx | 3 |
-w- | 2 |
–x | 1 |
— | 0 |
If you know binary you will notice that it is the decimal value of binary digits 001 = 1 010 = 2 100 = 4 so combinations will then be 101 = 4 + 1 = 5 corresponding to r-w