Linux CHMOD Command

in linux and unix type operating systems,there is a set of rules for each file which defines who can access that file,and how they can access it.these rules are called file permission or file modes.the command name chmod stands for change mode,and it is used to define the way a file can be accessd.

Syntax

$chmod [expression] [file_name]

Permissions

Permissions defines the permissions for owner of the file(the"user"),members of the group who owns the file(the "gruop"),and anyone else("other").there are two ways to represent these permission:with sysbols(alphanumeric characters), or with octal numbers(the digits 0 through 7).

Let's say you are the owner of a file named file1 and you want to set its permissions so that.

1.the user can read,write,and execute it.

2.members of your group can read and execute it,and others may only read it.

1.Symbolic Method


$chmod u=rwx,g=rx,o=r file1
							

this is an example of using symbolic permission notation.the letters u,g and o stands for "user","group",and "other", and the letters "r","w",and "x" stands for "read","write",and "execute",respectively.the commas separate the different classes of permission,and there are no spaces in between them.

Octal Method


$chmod 754 file1
							

here the digits 7,5, and 4 each individually represent the permissions for the user,group,and others,in that order.each digit is a combination of the number 4,2,1,0.

Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!