Create user mei as a member of both audio and video supplementary groups.
Which command is appropriate?
useradd -G GROUP1,GROUP2 USER accepts a comma-separated supplementary-group list.
Detailed explanation
useradd -G audio,video meiCorrect. It supplies both supplementary groups as one comma-separated list.
Correct. It supplies both supplementary groups as one comma-separated list.
useradd -g audio,video meiIncorrect. -g selects a single primary group.
Incorrect. -g selects a single primary group.
useradd -G audio video meiIncorrect. The supplementary list is one argument separated with commas.
Incorrect. The supplementary list is one argument separated with commas.
useradd -a audio,video meiIncorrect. useradd does not use -a for this option.
Incorrect. useradd does not use -a for this option.
Try it yourself
An example you can run in a temporary verification environment.
useradd --help | grep -E -- '-G,|--groups'Expected result
補助グループ一覧を示す説明行Key points
- -G selects supplementary groups
- Use comma-separated values
- -g is one primary group
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.