EX200 Exam QuestionsBrowse all questions from this exam

EX200 Exam - Question 97


SIMULATION -

Create the following users, groups, and group memberships:

A group named adminuser.

A user natasha who belongs to adminuser as a secondary group A user harry who also belongs to adminuser as a secondary group.

A user sarah who does not have access to an interactive shell on the system, and who is not a member of adminuser, natasha, harry, and sarah should all have the password of redhat.

Show Answer
Correct Answer:

The correct series of commands for this task is as follows: First, you need to create a group named 'adminuser'. The command for this is 'groupadd adminuser'. Next, you need to create the users natasha and harry, adding them to the 'adminuser' group as a secondary group. The command for natasha is 'useradd -G adminuser natasha' and for harry it is 'useradd -G adminuser harry'. For the user sarah, who should not have access to an interactive shell, use the command 'useradd -s /sbin/nologin sarah'. To set the password 'redhat' for each user, use the command 'echo redhat | passwd --stdin natasha', 'echo redhat | passwd --stdin harry', and 'echo redhat | passwd --stdin sarah'.

Discussion

1 comment
Sign in to comment
STFN2019
Sep 25, 2021

Full solution: # groupadd adminuser # useradd -aG adminuser natasha # useradd -aG adminuser harry # useradd -s /sbin/nologin sarah # echo 'redhat' | passwd --stdin natasha # echo 'redhat' | passwd --stdin harry # echo 'redhat' | passwd --stdin sarah

[Removed]
May 16, 2022

This is correct. On the useradd -s, "-s" is for "shell."

kitkat
Jul 6, 2022

what is the a in -aG for? Help page for useradd has no mention of -a option.