The chmod command is used to change file access permissions in Linux.
Syntax: chmod [option] [mode] <file1, file2, ...>
Option: The following is a list of some important options that can be provided with the
Mode: Mode is written in the following format:
[ugoa] [+-=] [rwxXstugo]
The combination of ugoa specifies the users for whom the file access permissions will be
ugoa, u is for the user who owns the file,
g is for other users in the file group, o is for other users not in the file group, and a is for all
The operator + adds the specified permissions to the existing permissions of each file. The
removes, and the = character specifies
that the specified permissions are the only permissions for that file.
The combination of rwxXstugo is permission type. In rwxXstugo, r is for read, w is for write,
x is for
execute, X is to execute only if the file is a
directory or already has execute permission for some user, s is to set user or group ID on
is to save program text on swap device,
u are the permissions that the user who owns the file currently has for it, g are the
other users in the file group have for the
file, and o are the permissions that other users not in the file group have for the file.
Answer option A is incorrect. The chown command is used to change the user or group
the files specified with the command.
Answer option D is incorrect. The chgrp command is used to change only the group
ownership of the
files specified with the command.
What is the chgrp command?
The chgrp (from change group) command is used by unprivileged users to change the
associated with a file. Unlike the chown command, chgrp allows regular users to change
groups, but only to one of which they are
a member. The
general syntax of the chgrp command is as follows:
chgrp group target1 [target2 ..]
The group parameter indicates the new group with w