Exam EX200 All QuestionsBrowse all questions from this exam
Question 21

SIMULATION -

Add user: user1, set uid=601 -

Password: redhat -

The user's login shell should be non-interactive.

    Correct Answer:

    To add a user with specific UID, set a password, and ensure the user's login shell is non-interactive, you can use the following steps. First, use the 'useradd' command to create the user with UID 601 and assign a non-interactive shell. The non-interactive shell can be '/sbin/nologin' to prevent the user from logging in interactively. Then, set the password for the user using the 'passwd' command. The required commands are: # useradd -u 601 -s /sbin/nologin user1 # passwd user1 (redhat)

Discussion
deepbrown

useradd -u 601 -s /sbin/nologin user1 ; echo "redhat" | passwd --stdin user1

Dadash

In RHEL 9 standart UID start from 1000. You can't create user with UID 601

ly01

This is not true. From /etc/login.defs: # Min/max values for automatic uid selection in useradd(8) # UID_MIN 1000 UID_MAX 60000 it is for *automatic* selection. You can specify manually whatever you want.

lgu

useradd -u 601 -s /sbin/nologin user1 passwd user (enter redhat) cat /etc/passwd to check shell