In this exercise, you create several users on your system and set passwords for those users.
Outcomes
Configure a Linux system with additional user accounts.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command prepares your environment and ensures that all required resources are available.
[student@workstation ~]$ lab start users-user
Instructions
From workstation, open an SSH session to servera as the student user, and switch to the root user.
[student@workstation ~]$ssh student@servera...output omitted... [student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#
Create the operator1 user and confirm that it exists in the system.
[root@servera ~]#useradd operator1[root@servera ~]#tail /etc/passwd...output omitted... operator1:x:1002:1002::/home/operator1:/bin/bash
Set the password for operator1 to redhat.
[root@servera ~]#passwd operator1Changing password for user operator1. New password:redhatBAD PASSWORD: The password is shorter than 8 characters Retype new password:redhatpasswd: all authentication tokens updated successfully.
Create the additional operator2 and operator3 users. Set their passwords to redhat.
Add the operator2 user.
Set the password for operator2 to redhat.
[root@servera ~]#useradd operator2[root@servera ~]#passwd operator2Changing password for user operator2. New password:redhatBAD PASSWORD: The password is shorter than 8 characters Retype new password:redhatpasswd: all authentication tokens updated successfully.
Add the operator3 user. Set the password for operator3 to redhat.
[root@servera ~]#useradd operator3[root@servera ~]#passwd operator3Changing password for user operator3. New password:redhatBAD PASSWORD: The password is shorter than 8 characters Retype new password:redhatpasswd: all authentication tokens updated successfully.
Update the operator1 and operator2 user accounts to include the Operator One and Operator Two comments, respectively.
Verify that the comments exist for the user accounts.
Run the usermod -c command to update the comments of the operator1 user account.
[root@servera ~]# usermod -c "Operator One" operator1Run the usermod -c command to update the comments of the operator2 user account.
[root@servera ~]# usermod -c "Operator Two" operator2View the /etc/passwd file to confirm that the comments for each of the operator1 and operator2 users exist.
[root@servera ~]#tail /etc/passwd...output omitted... operator1:x:1002:1002:Operator One:/home/operator1:/bin/bash operator2:x:1003:1003:Operator Two:/home/operator2:/bin/bash operator3:x:1004:1004::/home/operator3:/bin/bash
Delete the operator3 user along with any personal data of the user.
Confirm that the operator3 does not exist.
Remove the operator3 user from the system.
[root@servera ~]# userdel -r operator3Confirm that the operator3 user does not exist.
[root@servera ~]# tail /etc/passwd
...output omitted...
operator1:x:1002:1002:Operator One:/home/operator1:/bin/bash
operator2:x:1003:1003:Operator Two:/home/operator2:/bin/bashNotice that the preceding output does not display the user account information of operator3.
Confirm that the operator3 user home directory does not exist.
[root@servera ~]# ls -l /home
total 0
drwx------. 4 devops devops 90 Mar 3 09:59 devops
drwx------. 2 operator1 operator1 62 Mar 9 10:19 operator1
drwx------. 2 operator2 operator2 62 Mar 9 10:19 operator2
drwx------. 3 student student 95 Mar 3 09:49 studentExit the root user's shell to return to the student user's shell.
[root@servera ~]# exit
logout
[student@servera ~]$Log off from the servera machine.
[student@servera ~]$ exit
logout
Connection to servera closed.
[student@workstation ~]$This concludes the section.