A system administrator needs to create a new group named 'developers' with GID 1500 and add the user 'alice' to this group. Which set of commands accomplishes this?
Correct: groupadd creates the group with GID 1500, usermod appends alice to the supplementary group.
Why this answer
`groupadd -g 1500 developers` creates the group with the specified GID, and `usermod -aG developers alice` adds the user 'alice' to the supplementary group 'developers' while preserving her existing group memberships (the `-a` flag is essential with `-G` to avoid overwriting them). This matches the requirement exactly.
Exam trap
The trap here is that candidates often forget the `-a` flag with `usermod -G`, assuming `-G` alone appends, when in fact it replaces all supplementary groups, leading to unintended removal of existing group memberships.
How to eliminate wrong answers
Option A is wrong because `newgrp` is used to change a user's primary group for a login session, not to create a group or add a user to a group; `adduser` is a Debian/Ubuntu interactive tool that does not accept a group name as a direct argument in that syntax. Option B is wrong because `create group` is not a valid Linux command; the correct command is `groupadd`, and `useradd -G developers alice` would create a new user 'alice' (if she doesn't exist) and set her supplementary groups, but it does not create the group first and would fail if the group doesn't exist. Option C is wrong because `usermod -G developers alice` without the `-a` flag replaces all supplementary groups of 'alice' with only 'developers', potentially removing her from other necessary groups.