RHCE User and Group Management 1 — Questions and Answers
Question 1: Which file stores hashed passwords for local user accounts in RHEL?
- /etc/passwd
- /etc/shadow (Correct answer)
- /etc/group
- /etc/gshadow
Correct answer: /etc/shadow
`/etc/shadow` stores encrypted passwords and password aging information for local users.
Question 2: What command creates a new user named `jdoe` with a home directory?
- adduser jdoe
- useradd -m jdoe (Correct answer)
- usermod -m jdoe
- newuser jdoe
Correct answer: useradd -m jdoe
`useradd -m jdoe` creates the user and the `-m` flag ensures the home directory is created.
Question 3: Which command sets an expiry date of 2026-12-31 for user `jdoe`?
- passwd --expire 2026-12-31 jdoe
- chage -E 2026-12-31 jdoe (Correct answer)
- usermod --expiry 2026-12-31 jdoe
- chage -e 2026-12-31 jdoe
Correct answer: chage -E 2026-12-31 jdoe
`chage -E` sets the account expiration date for a user in YYYY-MM-DD format.
Question 4: What does the `id` command display when run as a normal user?
- Hostname and uptime
- UID, GID, and group memberships (Correct answer)
- Logged-in users
- Current shell and PATH
Correct answer: UID, GID, and group memberships
The `id` command prints the UID, GID, and supplementary group memberships of the current or specified user.
Question 5: Which command adds user `jdoe` to the supplementary group `wheel`?
- groupadd wheel jdoe
- usermod -aG wheel jdoe (Correct answer)
- gpasswd -a wheel jdoe
- useradd -G wheel jdoe
Correct answer: usermod -aG wheel jdoe
`usermod -aG wheel jdoe` appends the user to the `wheel` group without removing existing group memberships.
Question 6: What field in `/etc/passwd` specifies the user's default shell?
- 4th field
- 5th field
- 6th field
- 7th field (Correct answer)
Correct answer: 7th field
The seventh (last) field in `/etc/passwd` specifies the user's login shell.
Which file stores hashed passwords for local user accounts in RHEL?