Here I'm giving a brief explanation on how to changes the permission of a file in Linux/Unix system.
Syntax;
chmod [numeric number] [file]
here [numeric number] is created using the following criteria.
owner (User who owns the file.) | group (Group that owns the file.) | anybody (Other) | |
non | 0 | 0 | 0 |
read | 4 | 4 | 4 |
write | 2 | 2 | 2 |
execute | 1 | 1 | 1 |
so its easy.
if you want only read by owner;
chmod 400 file
if only executed by others
chmod 001 file
if read/write by the owner and only read by everyone else
chmod (4+2)(4)(4) file
which is;
chmod 644 file
With this if all need executable rights
chmod (4+2+1)(4+1)(4+1) file
that's it;
chmod 755 file
This can also be calculated in a more professional way.
this can be interpreted as;
- rwx r-x r-- file--111 101 100
here;
r read
w write
x executable
- non
Where now when we convert each set binary digits to decimal,
|
|
We get the numeric values we wonted. In this case its 754
So we have to use the command.
chmod 754 file
Macho, this is really useful. I wanted to know what these numbers are from a long time but never had time to look for it. thanks...!
ReplyDeleteAn excellent information provided thanks for all the information i must say great efforts made by you. thanks a lot for all the information you provided.
ReplyDeleteDietplanpdf.com
Ketosidedishes.com