RHCSA Exam QuestionsBrowse all questions from this exam

RHCSA Exam - Question 8


SIMULATION -

Create a user named alex, and the user id should be 1234, and the password should be alex111.

Show Answer
Correct Answer:

To create a user named alex with a user ID of 1234 and set the password to alex111, follow these steps: Firstly, use the 'useradd' command with the '-u' option to specify the user ID. The command will be: 'useradd -u 1234 alex'. Secondly, use the 'passwd' command to set the password for the user alex. The command sequence will be: 'passwd alex', then enter 'alex111' twice when prompted to set and confirm the password.

Discussion

5 comments
Sign in to comment
ktd971
Jan 25, 2023

useradd -u 1234 -p alex111 -m alex

Lazylinux
Aug 11, 2024

WRONG: You cannot use -p as the password will be encrypted and no one would now it, it maybe useful for service accounts that are system managed - i like to use this and can save time if have multiple users => for user in alex; do useradd -m -G -s 1234 $user; echo "alex111" | passwd --stdin $user; done Remember: G to add to grp membership and you can add any other option and if more than one user with i.e. nologin and different passwd then just replace username at start but if all shares same passwd and group membership then saves you time as some questions require that

Rahul95
May 31, 2023

#useradd -u 1234 alex #passwd alex - it will ask for new password for user alex #cat /etc/passwd | grep alex or id alex - to verify

SOAPGUY
Sep 15, 2022

one more '-' needed; echo alex111 | passwd --stdin alex

Mayowa15
Nov 29, 2022

#useradd alex -u 1234 #passwd alex #alex111 #alex111

ogwogwo
Sep 27, 2023

With The answers I see, it makes the uid and the gid the same while the question asks only the uid to be changed.

smdrouiss
May 28, 2024

It doesn't mention the group ID

JAlexander35
Mar 12, 2025

doesn't specify that the gid can't be changed, so it's fair game