CHMOD is a Unix command created from the words ‘change mode’. CHMOD permissions is used to change permissions or user privilege of a file.
Kinds of Users :
There are 3 different kinds of users who will access your files.
1. Owner – Users who has the server administrator rights.
2. Group – Specific group of people that the server administrator has identified.
3. Public – World.
Types of Permission :
1. Read – Access to view the file.
2. Write – Access to write and delete the file.
3. Execute – Access to run a file or program.
The index used for alphabets used are as follows:
U = User
G = Group
W = World
r = Readable
w = writable
x = executable
– = no permission
As you can see, each row-coloumn intersection has a value. Typically,
1. The ‘Read’ access level has a value of 4,
2. The ‘Write’ access level has a value of 2, and
3. The ‘Execute’ access level has a value of 1.
The CHMOD values from each row are added up into one of the columns of the final value.
U G W
rwx rwx rwx chmod 777 filename
rwx rwx r-x chmod 775 filename
rwx r-x r-x chmod 755 filename
rw- rw- r– chmod 664 filename
rw- r– r– chmod 644 filename
Here is another way of looking at it:
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody
To get a combination, just add them up. For example, to get read, write, execute by owner, read, execute, by group, and execute by anybody, you would add 400+200+100+040+010+001 to give 751.