nerdexam
CompTIA

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.

System Management

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)
  • A
    5% (2)
  • B
    93% (38)
  • D
    2% (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.

AUsermod -sG wheel comptia

`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.

BUseradd -sG wheel comptiaCorrect

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.

Cvisudo -sG wheel comptia
Dsudo -sG wheel comptia

Concept tested: Linux user and group management

Source: https://man7.org/linux/man-pages/man8/useradd.8.html

Topics

#User Management#Group Management#Linux Commands#useradd

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice