XK0-005 · Question #371
An administrator wants to add a user named comptia to the system administrators group. Which of the following commands will accomplish this task?
The correct answer is B. Useradd -sG wheel comptia. To create a new user named comptia and simultaneously add them to the wheel group, the useradd command with the appropriate group option is used.
Question
An administrator wants to add a user named comptia to the system administrators group. Which of the following commands will accomplish this task?
Options
- AUsermod -sG wheel comptia
- BUseradd -sG wheel comptia
- Cvisudo -sG wheel comptia
- Dsudo -sG wheel comptia
How the community answered
(41 responses)- A5% (2)
- B93% (38)
- D2% (1)
Why each option
To create a new user named `comptia` and simultaneously add them to the `wheel` group, the `useradd` command with the appropriate group option is used.
`usermod` is used to *modify* an existing user, not to create a new one. C: `visudo` is used to edit the sudoers file, which controls sudo privileges, not to manage user groups directly. D: `sudo` is used to execute a command with elevated privileges and does not manage user accounts or groups.
The `useradd` command is used to create a new user account on a Linux system. While `-s` is for shell, assuming `-G` is intended for groups from `-sG`, `useradd -G wheel comptia` creates the user `comptia` and assigns them to the `wheel` supplementary group, which is commonly used for system administrators.
Concept tested: Linux user and group management
Source: https://man7.org/linux/man-pages/man8/useradd.8.html
Topics
Community Discussion
No community discussion yet for this question.