010-160 Users and Group Management 2 — Questions and Answers
Question 1: Which file stores the encrypted passwords for user accounts on a modern Linux system?
- /etc/passwd
- /etc/shadow (Correct answer)
- /etc/gshadow
- /etc/security
Correct answer: /etc/shadow
Modern Linux systems store encrypted passwords in /etc/shadow, which is readable only by root.
Question 2: What command would you use to lock a user account so they cannot log in?
- usermod -d
- usermod -L (Correct answer)
- userdel -r
- passwd -u
Correct answer: usermod -L
usermod -L locks a user account by prepending a '!' to the password hash in /etc/shadow.
Question 3: Which field in /etc/passwd specifies the user's default shell?
- Field 4
- Field 5
- Field 6
- Field 7 (Correct answer)
Correct answer: Field 7
The seventh (last) field in /etc/passwd specifies the user's login shell, e.g., /bin/bash.
Question 4: What does the command 'id username' display?
- The user's login history
- The user's UID, GID, and group memberships (Correct answer)
- The user's home directory
- The user's password expiry information
Correct answer: The user's UID, GID, and group memberships
The id command displays a user's numeric UID, primary GID, and all supplementary group memberships.
Question 5: Which command removes a user and their home directory from the system?
- usermod -r username
- userdel username
- userdel -r username (Correct answer)
- deluser username
Correct answer: userdel -r username
userdel -r deletes the user account and recursively removes their home directory and mail spool.
Question 6: A new user is created with useradd. Where is their home directory placed by default?
- /home/username (Correct answer)
- /usr/username
- /var/home/username
- /root/username
Correct answer: /home/username
By default, useradd creates the home directory at /home/username unless overridden with the -d option.
Question 7: Which command interactively changes a user's password?
- chpass
- usermod -p
- passwd (Correct answer)
- chpwd
Correct answer: passwd
The passwd command prompts for a new password and updates /etc/shadow with the new hash.
Which file stores the encrypted passwords for user accounts on a modern Linux system?