Use the existing developers group as alice's primary group.
Which command is appropriate?
useradd -g GROUP sets the primary GID; -G adds supplementary groups.
Detailed explanation
useradd -g developers aliceCorrect. -g developers sets the account's primary group.
Correct. -g developers sets the account's primary group.
useradd -G developers aliceIncorrect. -G specifies supplementary group membership.
Incorrect. -G specifies supplementary group membership.
groupadd alice developersIncorrect. groupadd creates groups and does not set a user's primary group.
Incorrect. groupadd creates groups and does not set a user's primary group.
passwd -g developers aliceIncorrect. passwd does not configure primary group membership.
Incorrect. passwd does not configure primary group membership.
Try it yourself
An example you can run in a temporary verification environment.
useradd --help 2>&1 | grep -E -- '--gid|-g,' | head -n 1Expected result
-gまたは--gidの説明Key points
- -g primary group
- -G supplementary groups
- Group must exist
Notes
- Environment: shadow-utils useradd / help読取のみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.