Red Hat System Administration I
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 toserveraas thestudentuser, and switch to therootuser.[student@workstation ~]$
ssh student@servera...output omitted... [student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#Create the
operator1user 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/bashSet the password for
operator1toredhat.[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
operator2andoperator3users. Set their passwords toredhat.Add the
operator2user. Set the password foroperator2toredhat.[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
operator3user. Set the password foroperator3toredhat.[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
operator1andoperator2user accounts to include theOperator OneandOperator Twocomments, respectively. Verify that the comments exist for the user accounts.Run the
usermod -ccommand to update the comments of theoperator1user account.[root@servera ~]#
usermod -c "Operator One" operator1Run the
usermod -ccommand to update the comments of theoperator2user account.[root@servera ~]#
usermod -c "Operator Two" operator2View the
/etc/passwdfile to confirm that the comments for each of theoperator1andoperator2users 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
operator3user along with any personal data of the user. Confirm that theoperator3does not exist.Remove the
operator3user from the system.[root@servera ~]#
userdel -r operator3Confirm that the
operator3user 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
operator3user home directory does not exist.[root@servera ~]#
ls -l /hometotal 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
rootuser's shell to return to thestudentuser's shell.[root@servera ~]#
exitlogout [student@servera ~]$Log off from the
serveramachine.[student@servera ~]$
exitlogout Connection to servera closed. [student@workstation ~]$