010-160 System Security & User Permissions 5 — Questions and Answers
Question 1: Which /etc/passwd field specifies a user's home directory?
- Field 4 (GID)
- Field 5 (GECOS)
- Field 6 (Correct answer)
- Field 7 (shell)
Correct answer: Field 6
Field 6 (the sixth colon-delimited field) in /etc/passwd specifies the user's home directory path.
Question 2: What does the `su -` command do differently than `su`?
- Switches to root without requiring a password
- Starts a login shell that loads the target user's full environment (Correct answer)
- Grants sudo privileges temporarily
- Opens a restricted shell for the target user
Correct answer: Starts a login shell that loads the target user's full environment
`su -` (or `su -l`) starts a login shell, sourcing the target user's profile and environment variables.
Question 3: How can you allow a user to run only the `reboot` command with sudo without a password?
- Add 'username ALL=(ALL) NOPASSWD: /sbin/reboot' to /etc/sudoers (Correct answer)
- Add 'username reboot' to /etc/security/access.conf
- Run 'chmod u+s /sbin/reboot'
- Add username to the 'reboot' group
Correct answer: Add 'username ALL=(ALL) NOPASSWD: /sbin/reboot' to /etc/sudoers
A NOPASSWD rule in /etc/sudoers grants passwordless sudo access to a specific command.
Question 4: What is the UID of the root user on a standard Linux system?
- 0 (Correct answer)
- 1
- 100
- 65534
Correct answer: 0
Root always has UID 0, which grants unrestricted access to the system.
Question 5: Which command removes a user account along with their home directory?
- userdel username
- userdel -r username (Correct answer)
- usermod -d /dev/null username
- deluser username
Correct answer: userdel -r username
`userdel -r username` deletes the user account and recursively removes their home directory and mail spool.
Question 6: What does a '.' in the second position of `ls -l` output indicate on SELinux-enabled systems?
- The file has extended ACLs
- The file has an SELinux security context (Correct answer)
- The file is immutable
- The file has the sticky bit set
Correct answer: The file has an SELinux security context
A '.' after the permission bits indicates an SELinux security context is applied to the file.
Question 7: Which command displays all currently logged-in users and their active processes?
- who
- w (Correct answer)
- users
- last
Correct answer: w
`w` shows who is logged in plus what each user is currently running, along with system load.
Which /etc/passwd field specifies a user's home directory?