Mighty Chmod
The chmod
command in Linux is used to modify the permissions and access mode of files and directories. These are the permissions that control who can read, write and execute the file.
Two types of modes for specifying permission: symbolic and octal mode. In symbolic mode, one uses letters and operators to specify the permission. Whereas octal has a three-digit number for specifying the permission.
In octal method we specify permission using three-digit number. Where..
First digit specify the permission for Owner.
Second digit specify the permission for Group.
Third digit specify the permission for Others. The digits
NOTE: The digits are calculated by adding the values of the individual permissions.
Value | Permission |
4 | Read Permission |
2 | Write Permission |
1 | Execute Permission |
Octal method is the most widely used type .
How to change permissions of multiple files at the same time ?
Answer : Suppose you want to change permissions of all the text files in a directory /home/ubuntu/dev .
chmod 755 /home/ubuntu/dev *.txt
How to change permissions of more than one different type of file ?
Answer : Suppose you have two files sum.sh and calc.txt you want to change permissions on these 2 files .
chmod 766 /home/ubuntu/dev sum.sh calc.txt