Using Octal Notations to change file permissions Below are the octal notations for giving permissions
Read 4
Write 2
Execute 1
---------------
All 7
---------------
For combination of permissions below octal notations are used
Read and Write 6
Read and execute 5
Write and Execute 3
Ex: $ chmod 645 file1
In the above command
To the user 6 (read and write)
Group 4 (read)
Others 5 (read and execute)
These permissions are given to all. These are latest permissions.
The previous permissions of the file are removed and latest permissions will be added.
Ex 4:
$ ls –l file2
- r-x rw- -wx 3 user2 group2 5432 dec 09:00 file2
Requirement: User adding “w” and removing “x”
Group removing “w” and adding “x”
Others adding “r” and removing “x”
$ chmod 656 file2
$ ls –l file2
- rw- r-x rw- 3 user2 group2 5432 dec 10:00 file2