Hello everyone In this Article we are going to learn Permission management in Linux in a very simple and easy step-by-step approach
Linux permission
Three basics attributes of permissions are
- Read / Write / Execute
1 Read in Symbolic we can denote it as r and in the numeric value, we can denote this as 4
2. Write in Symbolic we can denote it as w and in the numeric value, we can denote this as 2
3. Execute in Symbolic we can denote it as x and in the numeric value, we can denote this as 1
If we combine all the attributes in the symbolic form it becomes rwx and in the numeric form, it becomes 7.
What operations we can perform when we are working with the permission of the directory.
If we give read permission on the folder then we can list the things that are inside of the folder we can execute # ls -ld command on a folder
If we give write permission on the folder then we can create content inside the folder it means that we can create the files and folder inside the folder.
If we give execute permission on the folder then we can go inside the folder using the cd command
Sometimes there is a situation is that we have to give the read permission on the folder now if a person executes the ls command on that folder then the ls command will not work.
Soo If anyone gives a task to put read permission on the folder then add an execute ( x ) on its own side, if we don’t give execute ( x ) permission then read permission will not work also.
If we assign write permission on the folder that means that read and execute must be done on own side. means full permission must be given to the folder for the write permission
What operations we can perform when we are working with the permission of the file.
If we give read permission on file then we can read the content of file
If we give write permission on file then we can write the content in the file
If we give execute permission on file then we can run the file as a script
# ls -ld – To view the permission of the directory we can execute ls command with the -ld options command
- d – denote that it is a directory
- rwx – This Field denotes the owner of the folder. eg -The user who made this folder.
- r-x – Group permission on the folder eg. the users who are inside of the root group having this permission.
- r-x – other permission – User who made folder instead of that user everyone else comes in other category of permission.
- ( . ) tell ACL permission if there is ( + ) instead of ( . ) then ACL (Access Control List ) is added on this folder
- The number of links to the directory here number of links is 1.
- Owner of the directory
- Group owner of the directory
- Size of the directory
- Creation of Date and Time of the directory
- Name of the directory.
# ls -l – To view the permission of the file we can execute the ls command with the -l option command.
Total is 11 attribute to read the permission
- ( – ) It means that this is a file
- rw- This Field denotes the owner of the file. eg -The user who made this file.
- r- – Group permission on the file eg. the users who are inside of the root group having this permission
- r- – Other permission – User who made folder instead of that user everyone else comes in other category of permission.
- ( . ) tell ACL permission if there is ( + ) instead of ( . ) then ACL (Access Control List ) is added on this file
- The number of links to the file here number of links is 1.
- Owner of the File
- Group owner of the File
- Size of the file
- Creation of Date and Time of the file
- Name of the file.
When the root user create a directory then default permissions are
# mkdir /Directory
The mkdir command is used to make the directory in the Linux kernel
The Default Permission on directory will be as follow
- d rwx r-x r-x in the symbolic form of permission
- d 7 5 5 in numeric form of permission
When root user create the file then default permissions are
# touch /tutdevopsfile
The touch command is used to make the blank file in the Linux kernel
- – rw- r– r– in the symbolic form of permission
- – 6 4 4 in numeric value-form of permission
When normal user create directory then default permissions are
$ mkdir/tutdevopsdir
- d rwx rwx r-x – in the symbolic form of permission
- d 7 7 5 – in numeric value-form of permission
When normal user create file then default permissions are
$ touch File1.txt
- – rw- rw- r– in the symbolic form of permission
- – 6 6 4 in numeric value-form of permission
Conclusion
If you want to learn Linux in the most simple language then please click on this link.
This is the complete Introduction of how to view the file permission in the Linux kernel and what are the permissions are there in the Linux kernel if you have any doubts please feel free to comment below. Please don’t forget to join our email subscription to get the latest updates on DevOps Articles.