RHCSA RHCSA User and Group Management 2 — Questions and Answers
Question 1: Which file contains the encrypted password hashes for local user accounts on RHEL?
- /etc/passwd
- /etc/shadow (Correct answer)
- /etc/group
- /etc/gshadow
Correct answer: /etc/shadow
/etc/shadow stores encrypted password hashes and is readable only by root.
Question 2: A user needs to be added to the 'wheel' group without removing them from their existing groups. Which command accomplishes this?
- usermod -g wheel alice
- usermod -aG wheel alice (Correct answer)
- groupmod -a alice wheel
- gpasswd -r wheel alice
Correct answer: usermod -aG wheel alice
usermod -aG appends the group to the user's supplementary groups without removing existing ones.
Question 3: What is the default password aging maximum number of days set for a new user created with useradd on RHEL?
- 30
- 60
- 90
- 99999 (Correct answer)
Correct answer: 99999
By default, useradd sets PASS_MAX_DAYS to 99999, effectively meaning the password never expires.
Question 4: Which command forces a user named 'bob' to change their password on next login?
- passwd -e bob
- chage -d 0 bob
- passwd --expire bob
- Both A and B (Correct answer)
Correct answer: Both A and B
Both 'passwd -e bob' and 'chage -d 0 bob' set the password last-changed date to epoch 0, forcing a change on next login.
Question 5: What does the 'nologin' shell (e.g., /sbin/nologin) do when a user tries to log in interactively?
- Locks the account permanently
- Displays a message and refuses the interactive login (Correct answer)
- Deletes the user session
- Redirects to /bin/sh
Correct answer: Displays a message and refuses the interactive login
/sbin/nologin prints a polite message and exits, preventing interactive logins while still allowing services like FTP.
Question 6: Which command displays all groups a user named 'carol' belongs to?
- groups carol
- id carol
- getent group carol
- Both A and B (Correct answer)
Correct answer: Both A and B
Both 'groups carol' and 'id carol' show group memberships; id also shows UID and GID numerically.
Question 7: A newly created user account is locked immediately after creation. Which useradd option causes this behavior?
- -L
- -s /sbin/nologin
- -e 1970-01-01
- Accounts are always locked until a password is set (Correct answer)
Correct answer: Accounts are always locked until a password is set
useradd creates accounts without a password by default, leaving them in a locked state until a password is assigned with passwd.
Which file contains the encrypted password hashes for local user accounts on RHEL?