010-160 System Security & User Permissions 4 — Questions and Answers
Question 1: Which file contains the list of all groups on a Linux system?
- /etc/users
- /etc/group (Correct answer)
- /etc/shadow
- /etc/gshadow
Correct answer: /etc/group
/etc/group stores group definitions including group name, GID, and member list.
Question 2: A script has the SGID bit set. What happens when it executes?
- It runs with root privileges
- It runs with the privileges of the file's group owner (Correct answer)
- It runs with the calling user's primary group
- It prevents other users from executing it
Correct answer: It runs with the privileges of the file's group owner
The Set Group ID (SGID) bit causes execution with the file group's privileges rather than the caller's group.
Question 3: Which command is used to set an expiry date for a user's password?
- passwd -e
- usermod -e
- chage -E (Correct answer)
- chage -M
Correct answer: chage -E
`chage -E YYYY-MM-DD username` sets the date on which the account expires.
Question 4: What permission does 'r' grant on a directory?
- Allows creating files inside the directory
- Allows listing the directory's contents (Correct answer)
- Allows traversing into the directory
- Allows deleting the directory
Correct answer: Allows listing the directory's contents
Read permission on a directory allows listing its contents with `ls`.
Question 5: Which command would display the last time each user logged in?
- last
- lastb
- lastlog (Correct answer)
- who
Correct answer: lastlog
`lastlog` reads /var/log/lastlog and shows the most recent login time for every user account.
Question 6: What is the effect of running `chmod o-r file.txt`?
- Removes read permission from the owner
- Removes read permission from the group
- Removes read permission from others (Correct answer)
- Removes all permissions from the file
Correct answer: Removes read permission from others
In symbolic chmod syntax, 'o' means others, '-' removes, and 'r' is read permission.
Question 7: Which of the following best describes the principle of least privilege?
- Users should share accounts to minimize the number of accounts
- Users and processes should have only the minimum permissions needed for their tasks (Correct answer)
- The root user should perform all administrative work
- All files should be world-readable by default
Correct answer: Users and processes should have only the minimum permissions needed for their tasks
Least privilege limits access rights to the minimum necessary, reducing the attack surface.
Which file contains the list of all groups on a Linux system?