LPIC-1 Administrative Tasks Practice Question
A user 'jdoe' already exists. The administrator needs to add 'jdoe' to the 'staff' and 'admin' groups without changing other group memberships. Which command accomplishes this?
⚠ Common exam trap
The trap here is that candidates often forget the `-a` (append) flag with `usermod -G`, assuming `-G` alone adds groups, when in fact it replaces all supplementary group memberships, which is a common cause of accidental privilege removal.
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 -a -G staff,admin jdoe
The `usermod -a -G` command appends the user 'jdoe' to the supplementary groups 'staff' and 'admin' without altering existing group memberships. The `-a` (append) flag is essential; without it, `-G` would replace all current supplementary groups with only those listed. This matches the requirement to add the user to new groups while preserving other group memberships.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
usermod -a -G staff,admin jdoe
Why this is correct
The -a flag appends the listed supplementary groups while preserving jdoe's existing memberships, and -G sets supplementary groups rather than the primary group. Omitting -a would replace all current supplementary groups, so this form satisfies the requirement exactly.
- ✗
sed -i 's/^staff:.*/&jdoe/' /etc/group
Why it's wrong here
This sed substitution matches the staff line and appends jdoe without touching admin, and editing /etc/group directly bypasses the account database, leaving no admin membership and risking corruption. It is tempting as a quick text edit, but usermod -aG updates group membership through the proper system interface.
- ✗
usermod -G staff,admin jdoe
Why it's wrong here
usermod -G replaces the entire supplementary group list, so jdoe's existing memberships are discarded — contradicting the requirement to preserve them. The -a (append) flag is needed alongside -G. It is tempting because usermod is the correct tool for modifying an existing account's group membership.
- ✗
useradd -G staff,admin jdoe
Why it's wrong here
useradd creates new accounts; run against an existing 'jdoe' it fails, so memberships are never modified. It is tempting because -G lists supplementary groups, but that flag only applies at account creation. usermod -aG is required to append groups to an existing user.
Go deeper
Related to this question
About these practice questions
Courseiva writes every LPIC-1 question from scratch — 402 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LPIC-1 practice question is part of Courseiva's free LPI 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 LPIC-1 exam.