Chmod Command in Linux














































Chmod Command in Linux



In Linux, the chmod command is used to change the access permissions of a file. The name is an abbreviation of change mode.

Syntax:


The references are used to distinguish the users to whom the permissions apply i.e. they are a list of letters that specify whom to give the permissions to. The references are referred to by one of the following letters:


A few operators are used to specify how to change the access rights. The following operators are acceptable:


The modes denote which permissions to be added or removed from the specified classes. There are three basic modes which correspond to the basic permissions:


In Linux, to see the permissions to all the files, the ls -l command is used which lists all the files in the current working directory:


In the above figure, the files are displayed as follows:


The very first column represents the type of file. A - represents a normal file whereas a d represents a directory.

The first three letters are the permissions that the owner of the file has.

The first mik here represents the owner of the file and the second mik represents the group to which the owner belongs.

The second column represents the permissions that the users belonging to the same group (mik in this case) have.

The third column represents the permissions that other users have on the file.

Usage of chmod:


Before:


After:


Comments