EX200 Exam QuestionsBrowse all questions from this exam

EX200 Exam - Question 2


SIMULATION -

Add 3 users: harry, natasha, tom.

The requirements: The Additional group of the two users: harry, Natasha is the admin group. The user: tom's login shell should be non-interactive.

Show Answer
Correct Answer:

To add three users and meet the specified requirements, follow these steps systematically. First, create an 'admin' group if it doesn't already exist, which is needed for the additional groups of Harry and Natasha. Add Harry and Natasha to the system, making sure they are also part of the 'admin' group. Add Tom to the system with a non-interactive login shell. Then verify the changes. Here are the commands you would use, along with verification steps: 1. `groupadd admin` (Creates the 'admin' group if it doesn't exist). 2. `useradd -G admin harry` (Creates the user 'harry' and adds 'harry' to the 'admin' group). 3. `useradd -G admin natasha` (Creates the user 'natasha' and adds 'natasha' to the 'admin' group). 4. `useradd -s /sbin/nologin tom` (Creates the user 'tom' and sets the shell to non-interactive). 5. `id harry; id natasha` (Displays the user information to verify additional groups). 6. `cat /etc/passwd | grep tom` (Displays the user information to verify the login shell is non-interactive). This sequence ensures that the requirements are met and verified.

Discussion

9 comments
Sign in to comment
cloudsinair
May 15, 2023

RHEL 9.1 [root@server9 ~]# [root@server9 ~]#groupadd admin [root@server9 ~]# [root@server9 ~]# useradd harry -G admin [root@server9 ~]# useradd natasha -G admin [root@server9 ~]# [root@server9 ~]# useradd -s /sbin/nologin tom [root@server9 ~]#

ly01
Jul 8, 2024

it's all correct, I can't just understand if I have to read the question verbatim (but there is no admin group out of the box) or add them to the wheel group.

dehemox355
Mar 4, 2023

Is this dump still valid and up to date? I can't see questions about container or VDO and Stratis

Rahul95
May 31, 2023

#useradd harry #useradd natasha #useradd tom -s /sbin/nologin #groupadd admin #usermod -G admin harry #usermod -G admin natasha #cat /etc/group | grep admin - to verify #cat /etc/passwd | grep tom

thiruppathij
Sep 15, 2023

[root@servera ~]# groupadd admin [root@servera ~]# useradd harry [root@servera ~]# useradd natasha [root@servera ~]# useradd tom -s /sbin/nologin verify- commands [root@servera ~]# cat /etc/passwd [root@servera ~]# cat /etc/group or else #cat /etc/group | grep admin #cat /etc/passwd | grep tom

dunia
Oct 6, 2023

hello all , in the exam there is two connections which connection we should edit ?the active one ( the first connection ) we modify the existing OR we edit the second connection ? please anyone can answer?

nailimvali
Oct 24, 2022

*** useradd -s /sbin/nologin tom

BitterOldMan
Feb 28, 2023

The task says to add additional group admin, so shouldn't the command be: useradd -aG admin harry

wajdi005
Mar 5, 2023

You can do that, but the -G is also correct because the users are new. So you wont overnight any permissions.

BitterOldMan
Feb 28, 2023

Oops, answering my own question, capital -G does the append.

thomasstate
Nov 23, 2023

apart from the shell /sbin/nologin, which other is mostly use for user