SIMULATION -
Create a user named alex, and the user id should be 1234, and the password should be alex111.
SIMULATION -
Create a user named alex, and the user id should be 1234, and the password should be alex111.
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.
useradd -u 1234 -p alex111 -m alex
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
#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
one more '-' needed; echo alex111 | passwd --stdin alex
#useradd alex -u 1234 #passwd alex #alex111 #alex111
With The answers I see, it makes the uid and the gid the same while the question asks only the uid to be changed.
It doesn't mention the group ID
doesn't specify that the gid can't be changed, so it's fair game