Sunday, 10 August 2014

Chmod Examples

chmod [OPTION]... MODE[,MODE]... FILE...

Chmod (Change Mode) is used to change the permissions of a file, this is needed if you want to create shell scripts or set the permissions of a file.

The permissions are as follows:

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

now these values added up can set permissions for files, for example:

chmod 755
This command give all rights, the reason for this is because 400+040+004+200+100+010+001 = 755.

I hope this makes sense, there is a lot more to it then this but this should give you the basics.

No comments:

Post a Comment