Every File or directory in the Linux Operating system has an access level which specifies the group or the users can actually access it. Linux Provides us with mainly 3 access levels for each user group i.e. Read , Write and Execute. These permissions can be set for 3 types of users aka owner, owner's group and other users on the system.
For e.g. If I have a file named passwd.txt sitting on my Linux maching, I can totally control who can access it and what access rights are given.
In this tutorial, We'll be looking at some of the standard permission notations and what these notations actually mean.
1. Textual Representation of Linux/Unix File Permissions
The textual representation consists of 10 characters in which the first character shows filetype and the rest of all shows the permissions. These permissions are further divided in three groups owner , group and others.The first character is left as '-' if its a file and 'd' if its a directory.Each group have 3 symbols , rwx [STANDS for READ , WRITE , EXECUTE permissions], If any of them is denied it replaced by a '-'
Now that we know all about these rules so lets take an example and try to understand it.
The first thing to notice is the first character its a '-' so in this case the permission representation is that of a file.
Followed by the first character there are 3*3 ( = 9 ) characters and they all (taken in sets of 3) represent the permissions of a specific groups which are owner , group and others .
In our case its :-
rwx (Read , Write and Execute) for Owner.
r-x (Read and Execute) for Owner's Group.
r-x (Read and Execute) for Other Users.
Here's and Exercise for you to practice :-
Specify the File-type and Permissions (given to each group) in the following representation
The Numerical Representation is mainly in Octal format and It consists of numbers from 0-7 , the main usage and speciality of Octal representation is that its very simple and short , each octal number include read write and execute permissions of a group. e.g. “422” indicates permissions given to all the 3 groups , including “4” for owner , “2” for group , “3” for other users. Don't worry if you don't understand what these actually mean , we'll be covering that in this tutorial.
The Below Table Shows Some of the Octal Digits and their Permission equivalent :-
| Octal | Textual | Meaning | 0 | --- | No Access | 1 | --x | Execute Access | 2 | -w- | Write Access | 4 | r-- | Read Access
7 = 1+2+4 = Execute , Read , Write Access 6 = 2+4 = Write and Read Access 3 = 1+2 = Write and Execute Access
Find the meaning of the following Octal Representations
024 123 333 444 764
Thanks for reading and stay tuned for more.