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.
useradd -g audio,video meiIncorrect. -g selects a single primary group.
useradd -G audio video meiIncorrect. The supplementary list is one argument separated with commas.
useradd -a audio,video meiIncorrect. 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
Account record
Identity attributes such as a user ID, home directory, and login shell.
Group membership
Primary and supplementary groups used during permission checks.
Password aging
State and time limits that control password changes and account access.