RHCSA RHCSA User and Group Management 3 — Questions and Answers
Question 1: Which field in /etc/passwd defines the user's primary group?
- Field 3 (UID)
- Field 4 (GID) (Correct answer)
- Field 5 (GECOS)
- Field 7 (Shell)
Correct answer: Field 4 (GID)
The fourth field in /etc/passwd is the GID (Group ID), which specifies the user's primary group.
Question 2: What command would you use to change the GID of an existing group named 'developers' to 5000?
- groupmod -g 5000 developers (Correct answer)
- groupadd -g 5000 developers
- chgrp 5000 developers
- usermod -g 5000 developers
Correct answer: groupmod -g 5000 developers
groupmod -g changes the numeric GID of an existing group.
Question 3: An administrator runs 'chage -M 90 dave'. What does this accomplish?
- Sets the minimum days between password changes to 90
- Sets the maximum days a password is valid to 90 (Correct answer)
- Sets the account expiration to 90 days from now
- Sets the inactivity period to 90 days
Correct answer: Sets the maximum days a password is valid to 90
chage -M sets PASS_MAX_DAYS — the maximum number of days a password remains valid before forced change.
Question 4: Which file must be edited to set system-wide defaults for new user accounts such as home directory skeleton and shell?
- /etc/login.defs
- /etc/default/useradd (Correct answer)
- /etc/skel/profile
- /etc/profile.d/defaults.sh
Correct answer: /etc/default/useradd
/etc/default/useradd contains defaults like SHELL, HOME base, and SKEL used when useradd creates a new account.
Question 5: What is the purpose of the /etc/skel directory?
- Stores skeleton passwords for new users
- Contains template files copied to a new user's home directory (Correct answer)
- Holds default group assignments
- Stores system user UIDs
Correct answer: Contains template files copied to a new user's home directory
/etc/skel contains template files (like .bash_profile, .bashrc) that are copied into every new user's home directory at creation.
Question 6: Which command removes a user account AND their home directory and mail spool?
- userdel alice
- userdel -r alice (Correct answer)
- usermod -d /dev/null alice
- passwd -l alice
Correct answer: userdel -r alice
userdel -r removes the user's home directory and mail spool in addition to deleting the account.
Question 7: A user's account shows '!!' in the password field of /etc/shadow. What does this indicate?
- The password is encrypted with SHA-512
- The account has never had a password set and is locked (Correct answer)
- The account is expired
- Two-factor authentication is enabled
Correct answer: The account has never had a password set and is locked
'!!' in the shadow password field means no password has been set, leaving the account in a locked state.
Which field in /etc/passwd defines the user's primary group?