LPI Exam Questions

Which of the following commands is used to change file access permissions in Linux?

Which of the following commands is used to change file access permissions in Linux?

A.
chown

B.
chmod

C.
chperm

D.
chgrp

Explanation:

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 command:

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
changed. In
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 users.
The operator + adds the specified permissions to the existing permissions of each file. The -operator
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
execution, t
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 permissions
that
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 ownership
of
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 group
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 which the targets should be associated.
The target1 parameter indicates the files or directories for which the change should be made.
The target2 parameter indicates the optional additional files or directories for which the change
should be made.
For example:

The above command changes the group associated with ttt to ‘system’, provided the executing
user is a member of that group.
Answer option C is incorrect. There is no such command as chperm in Linux.