LFCS User and Group Management Practice Question
Which command adds an existing user to a supplementary group without removing the user from other groups?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
usermod -aG groupname username
The correct command is `usermod -aG groupname username`. The `-a` option (append) combined with `-G` (supplementary groups) adds the user to the specified group without affecting existing supplementary group memberships. Option A (`groupmod -a`) is incorrect because `groupmod` modifies group attributes, not user membership. Option B (`-A`) is not a valid `usermod` option. Option D (`-g`) changes the user's primary group, not supplementary groups.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
groupmod -a username groupname
Why it's wrong here
groupmod edits a group's own attributes, such as its GID or name; it has no -a flag and never touches a user's membership list. It tempts because -a conventionally means append elsewhere, but adding a user to a supplementary group requires usermod -aG, which writes the group into /etc/group's member field.
- ✗
usermod -A groupname username
Why it's wrong here
usermod has no -A option; its append flag is -a, and it must be paired with -G to name supplementary groups. The uppercase letter tempts as a plausible-looking append switch, but the command would be rejected outright, leaving the user's supplementary membership unchanged.
- ✓
usermod -aG groupname username
Why this is correct
The -a flag appends the group to the user's existing supplementary group list rather than replacing it; without -a, usermod -G would overwrite all current supplementary memberships. This preserves the user's other groups while adding the new one.
- ✗
usermod -g groupname username
Why it's wrong here
usermod -g sets the user's primary group, replacing the current primary GID in /etc/passwd, so it does not add a supplementary group at all. It tempts because usermod is the right tool, but -g targets the primary group; -aG appends supplementary groups without disturbing existing ones.
Go deeper
Related to this question
About these practice questions
One of 406 original LFCS practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LFCS practice question is part of Courseiva's free Linux Foundation certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LFCS exam.