Explain Absolute and Relative Permission Using chmod

Linux permissions are a set of rules that determine the level of access or control on user , file or directory. It helps to protect the system and its data by ensuring that only authorized users access.

To change file permission in Linux chmod command is used.

chmod command is categorized into three categories:

  • user
  • group
  • other

Command can be specified in either of two ways:

  1. relative permission
  2. absolute permission

1)relative permission: In relative permission it changes the permission specified in command and leave other permission unchanged.
syntax: chmod categorization permission filename
example chmod u+r file.txt

Following operation specified that need to performed:

+ assign permission
remove permission
= assign absolute permission for all
permission specified r, w ,x(read, write, execute)

2)Absolute permission: permission specified by setting all nine permission bits explicitly.in the chmod we used three octal number.

relative and absolute permission

Example Of Absolute And Relative Permission In Linux

Here is the practical example of absolute and relative permission that make you fully understand about different permission in Linux/Unix

1.Assign execute permission to the user but other permission remain unchanged for the file marks.dat

absolute and relative permission

2.Assign execute permission to all the category for the file stud list.txt and mark.dat.

secure6

3.Assign read permission to the categories group and other ,revoke execute permission from other for files marks.dat

secure8 edited

I hope you enjoyed this article, I request you to share it with your friends to spread the knowledge. If you want to make me to create post on some topic kindly comment here.