LCA User & Permission Management 4 — Questions and Answers
Question 1: Which chage command sets the account expiration date for user 'bob' to December 31, 2026?
- chage -E 2026-12-31 bob (Correct answer)
- chage -M 2026-12-31 bob
- passwd -e 2026-12-31 bob
- usermod -e 12/31/2026 bob
Correct answer: chage -E 2026-12-31 bob
chage -E sets the account expiration date in YYYY-MM-DD format.
Question 2: What is the purpose of the /etc/skel directory?
- Stores skeleton (template) files copied into new users' home directories (Correct answer)
- Contains security keys for system accounts
- Holds default shell configuration for root only
- Stores archived home directories of deleted users
Correct answer: Stores skeleton (template) files copied into new users' home directories
/etc/skel contains template files like .bashrc and .profile that are copied to a new user's home directory upon account creation.
Question 3: A file is owned by root with permissions -rwxr-xr-x. A regular user runs the file. Under which UID does the process execute?
- The user's own UID (Correct answer)
- UID 0 (root)
- The file's group GID
- An anonymous UID assigned at runtime
Correct answer: The user's own UID
Without the SUID bit, processes always run as the UID of the user who launched them, regardless of file ownership.
Question 4: Which command removes user 'carol' and deletes her home directory and mail spool?
- userdel carol
- userdel -r carol (Correct answer)
- deluser --purge carol
- usermod -d /dev/null carol
Correct answer: userdel -r carol
userdel -r removes the user account along with the home directory and mail spool.
Question 5: What does the SGID bit do when set on a directory?
- Prevents file deletion by non-owners
- New files created inside inherit the directory's group (Correct answer)
- Only the owner can read files inside
- Files run as the directory owner's UID
Correct answer: New files created inside inherit the directory's group
The SGID bit on a directory causes newly created files and subdirectories to inherit the directory's group ownership.
Question 6: Which field in /etc/passwd specifies the user's default login shell?
- Field 4
- Field 5
- Field 6
- Field 7 (Correct answer)
Correct answer: Field 7
The seventh field (last field) in /etc/passwd defines the user's default login shell, e.g., /bin/bash.
Question 7: A Linux administrator wants to force a password change on next login for user 'dave'. Which command achieves this?
- passwd -l dave
- chage -d 0 dave (Correct answer)
- usermod --expire dave
- passwd -u dave
Correct answer: chage -d 0 dave
chage -d 0 sets the last password change date to epoch 0 (Jan 1, 1970), which forces an immediate password change on next login.
Which chage command sets the account expiration date for user 'bob' to December 31, 2026?