Table of contents
No headings in the article.
In the previous blog, we learned about how to assign permissions to a directory by using "chmod" command. We learned to give permissions by read, write, and execute but now Linux has an amazing feature where we can assign the permissions by giving numbers in place of read, write, and execute.
For Example:
$ chmod ugo+r <Directory>
This command is assigning read permission to a user, group, and other level.
But, how can we assign read permissions to these three levels using Numeric Mode?
Example 1:
$ chmod 444 <Directory>
Let's break this command :
444 - Number 4 is for assigning read permission. Now you are wondering how this command will know to whom at which level I want to assign read permission ??
This is the beauty of Numeric Mode !!
This diagram tells us 4 number assigning read permission at all levels.
Come, Let's take a look into this.
Number | Permission Type | Symbol |
0) | No Permission | --- |
1) | Execute | -x |
2) | Write | -w |
3) | Execute+Write | -wx |
4) | Read | r-- |
5) | Read+Execute | r-x |
6) | Read+Write | rw- |
7) | Read+Write+Execute | rwx |
Example 2 :
You want to assign read and write permission to the user level and assign no permission to the group and other level.
$ chmod 600 <Name of Directory>
This command will assign (6 Number) only read and write to the user level and (0 number) will assign no permission to the group and other level.
I hope I added some knowledge to you. THANK YOU :)
You can follow me for more Linux and DevOps learnings. Soon, I am going to start writing a blog on DevOps tools too.