nerdexam
CompTIA

XK0-005 · Question #786

A systems administrator is reconfiguring existing user accounts in a Linux system. Which of the following commands should the administrator use to include "myuser" in the finance group?

The correct answer is D. usermod -aG finance myuser. To add an existing user, 'myuser', to an existing supplementary group, 'finance', the administrator should use the usermod command with the appropriate options.

System Management

Question

A systems administrator is reconfiguring existing user accounts in a Linux system. Which of the following commands should the administrator use to include "myuser" in the finance group?

Options

  • Agroupadd finance myuser
  • Bgroupmcd finance myuser
  • Cuseradd -g finance myuser
  • Dusermod -aG finance myuser

How the community answered

(24 responses)
  • A
    4% (1)
  • B
    13% (3)
  • C
    4% (1)
  • D
    79% (19)

Why each option

To add an existing user, 'myuser', to an existing supplementary group, 'finance', the administrator should use the `usermod` command with the appropriate options.

Agroupadd finance myuser

`groupadd` is used to create a new group, not to add an existing user to an existing group.

Bgroupmcd finance myuser

`groupmcd` is not a standard Linux command for managing groups or users.

Cuseradd -g finance myuser

`useradd` is used to create a new user account, not to modify an existing one, and `-g` would set the primary group for a *new* user.

Dusermod -aG finance myuserCorrect

The `usermod -aG finance myuser` command is the correct way to add an existing user ('myuser') to an existing supplementary group ('finance'). The `-a` option ensures the user is appended to the group without removing them from other existing groups, and `-G` specifies the supplementary group(s) to add.

Concept tested: Adding user to supplementary group

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

Topics

#User and Group Management#Linux Commands#System Administration

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice