Skip to main content

LPI E - Owners Test 3

5.3 Managing File Permissions and Ownership

Understanding and manipulating file permissions and ownership settings

Practice Exam Questions 3

Question 1:
What is the octal value for the permission set "rwxr-x---"?
A) 754
B) 740
C) 750
D) 764
/* --------------------- */

--------------------------

Answer 1 Below: 

--------------------------

/* --------------------- */

Details:
In the octal notation, each permission has a corresponding value: read (r) is 4, write (w) is 2, and execute (x) is 1. The first digit represents the user's permissions, the second digit represents the group's permissions, and the third digit represents the permissions for others. Therefore, "rwxr-x---" translates to the octal value 750.

Explanation:
The permission set "rwxr-x---" means that the user has read, write, and execute permissions, the group has read and execute permissions, and others have no permissions. Converting these permissions to their octal equivalents gives us 750.

Answer 1: C) 750

Question 2:
Which mode is recommended if you want to change the permissions to a specific value, such as 640?
A) Numeric mode
B) Symbolic mode
C) Recursive mode
D) Targeted mode

/* --------------------- */

--------------------------

Answer 2 Below: 

--------------------------

/* --------------------- */

Details: Numeric mode is recommended if you want to change the permissions to a specific value, such as 640.

Explanation: In numeric mode, permissions are represented using a three-digit octal value. Each digit corresponds to a specific permission (read, write, or execute) for the user, group, and others. Numeric mode allows you to set the permissions directly to the desired value, making it suitable for cases where you want precise control over the permissions, such as setting them to a specific value like 640.

Answer 2: A) Numeric mode

Question 3:
What is the octal value for the permission set "rw-r--r--"?
A) 644
B) 750
C) 755
D) 664

/* --------------------- */

--------------------------

Answer 3 Below: 

--------------------------

/* --------------------- */

Details:
In the octal notation, each permission has a corresponding value: read (r) is 4, write (w) is 2, and execute (x) is 1. The first digit represents the user's permissions, the second digit represents the group's permissions, and the third digit represents the permissions for others. Therefore, "rw-r--r--" translates to the octal value 644.

Explanation:
The permission set "rw-r--r--" means that the user has read and write permissions, the group has read permissions, and others have read permissions. Converting these permissions to their octal equivalents gives us 644.

Answer 3: A) 644

Question 4:
When using symbolic mode, which parameter is used to grant execute permission?
A) r
B) w
C) x
D) a

/* --------------------- */

--------------------------

Answer 4 Below: 

--------------------------

/* --------------------- */

Details:
In symbolic mode, the parameter "x" is used to grant execute permission.

Explanation:
Symbolic mode allows you to specify the target (user, group, others, or all), the action (grant, revoke, or set), and the permission (read, write, or execute) separately. When granting execute permission, the parameter to be used is "x".

Answer 4: C) x

Question 5:
What is the octal value for the permission set "rwxrwxrwx"?
A) 777
B) 755
C) 666
D) 644

/* --------------------- */

--------------------------

Answer 5 Below: 

--------------------------

/* --------------------- */

Details:
In the octal notation, each permission has a corresponding value: read (r) is 4, write (w) is 2, and execute (x) is 1. The first digit represents the user's permissions, the second digit represents the group's permissions, and the third digit represents the permissions for others. Therefore, "rwxrwxrwx" translates to the octal value 777.

Explanation:
The permission set "rwxrwxrwx" means that the user, group, and others all have read, write, and execute permissions. Converting these permissions to their octal equivalents gives us 777.

Answer 5: A) 777

Question 6:
Which mode is more useful if you want to flip a specific permission value without touching the current permissions for the file?
A) Numeric mode
B) Symbolic mode
C) Recursive mode
D) Targeted mode

/* --------------------- */

--------------------------

Answer 6 Below: 

--------------------------

/* --------------------- */

Details:
Symbolic mode is more useful if you want to flip a specific permission value without touching the current permissions for the file.

Explanation:
Symbolic mode allows you to specify the target (user, group, others, or all), the action (grant, revoke, or set), and the permission (read, write, or execute) separately. It is particularly useful when you want to change a specific permission without altering the existing permissions for the file. For example, you can use symbolic mode to add execute permissions for the user without affecting the group or others' permissions.

Answer 6: B) Symbolic mode

Question 7:
Which command is used to modify the ownership of a file or directory in Linux?
A) chown
B) chmod
C) chgrp
D) chperm

/* --------------------- */

--------------------------

Answer 7 Below: 

--------------------------

/* --------------------- */

Details:
The command "chown" is used to modify the ownership of a file or directory in Linux.

Explanation:
The "chown" command allows you to change the user and group ownership of a file or directory. By specifying the new username and groupname, you can transfer ownership to the desired user and group. Understanding how to use "chown" is essential for system administrators to manage file ownership effectively.

Answer 7: A) chown

Question 8:
What is the syntax for changing the group ownership of a file using the "chown" command?
A) chown groupname:username filename
B) chown username.groupname filename
C) chown username:groupname filename
D) chown groupname filename

/* --------------------- */

--------------------------

Answer 8 Below: 

--------------------------

/* --------------------- */

Details:
The syntax for changing the group ownership of a file using the "chown" command is "chown username:groupname filename".

Explanation:
To change the group ownership of a file, you need to specify both the new owner's username and the desired groupname. The syntax follows the format of "chown username:groupname filename". This allows you to transfer the ownership of a file to a specific user and group.

Answer 8: C) chown username:groupname filename

Question 9:
What command can be used to change only the group ownership of a file?
A) chown
B) chmod
C) chgrp
D) chown :groupname

/* --------------------- */

--------------------------

Answer 9 Below: 

--------------------------

/* --------------------- */

Details:
The command "chgrp" can be used to change only the group ownership of a file.

Explanation:
While the "chown" command can change both the user and group ownership of a file, if you only want to modify the group ownership, you can use the "chgrp" command. It allows you to specify the new groupname without affecting the user ownership of the file.

Answer 9: C) chgrp

Question 10:
Which command displays the groups a user belongs to in Linux?
A) groupmems
B) groups
C) grep
D) users

/* --------------------- */

--------------------------

Answer 10 Below: 

--------------------------

/* --------------------- */

Details:
The "groups" command displays the groups a user belongs to in Linux.

Explanation:
By executing the "groups" command, you can view the list of groups to which a particular user belongs. This information is helpful for managing file ownership and understanding the group memberships of users within the system.

Answer 10: B) groups

Question 11:
What command lists all the members of a specific group?
A) groupmems
B) users
C) groups
D) grep

/* --------------------- */

--------------------------

Answer 11 Below: 

--------------------------

/* --------------------- */

Details:
The "groupmems" command lists all the members of a specific group.

Explanation:
To retrieve a list of users who belong to a particular group, you can use the "groupmems" command. By specifying the group with the "-g" parameter and using the "-l" option, you can obtain a comprehensive list of group members. Note that the "groupmems" command requires root privileges, so it is typically executed with "sudo" when not logged in as the root user.

Answer 11: A) groupmems