Chmod
Chmod
Chmod
In Unix operating systems, the chmod command is used to change the access mode of a
file. The name is an abbreviation of change mode. Which states that every file and
directory has a set of permissions that control the permissions like who can read, write or
execute the file. In this the permissions have three categories: read, write, and execute
simultaneously represented by `r`, `w` and `x`. These letters combine together to form a
specific permission for a group of users.
The `chmod` command is used to modify this permission so that it can grant or restrict
access to directories and files. Let’s have a look at the syntax and options for the `chmod`
command in Linux Operating System.
Syntax:
chmod [options] [mode] [File_name]
“chmod” in Linux [options]
Options Description
Apply the permission change recursively to all the files and directories within the
`-R` specified directory.
It will display a message for each file that is processed. while indicating the
`-v` permission change that was made.
It works same as `-v` but in this case it only displays messages for files whose
`-c` permission is changed.
`-h` Change the permissions of symbolic links instead of the files they point to.
Note: Options in `chmod` are basically used for making changes in bulk and modifying
permissions across multiple files or directories at once.
“chmod” in Linux [mode]
The “mode” helps in setting new permissions that have to be applied to files or
directories.
This mode can be specified in several ways, we will discuss two modes: Symbolic and
Octal mode.
1) Symbolic mode
If we talk about symbolic mode, we can say that it is the most common method used for
specifying fir permissions. In this we have to make a combination
of letters and operators to set or tell what to do with permissions.
The following operators can be used with the symbolic mode:
Operators Definition
Letters Definition
Reference Class
u Owner
g Group
Reference Class
o Others
a All (owner,groups,others)
2) Octal modeIt is also a method for specifying permissions. In this method we specify
permission using three-digit number. Where..
4 Read Permission
2 Write Permission
1 Execute Permission