Red Hat System Administration I
Set a default local password policy, create a supplementary group for three users, allow that group to use sudo to run commands as root, and modify the password policy for one user.
Outcomes
Set a default password aging policy of the local user's password.
Create and use a supplementary group for new users.
Create three new users with the new supplementary group.
Set an initial password for the created users.
Configure the supplementary group members to use the
sudocommand to run any command as any user.Set a user-specific password aging policy.
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-review
Instructions
From the
workstationmachine, open an SSH session to theserverbmachine as thestudentuser and switch to therootuser.On the
serverbmachine, ensure that newly created users must change their passwords every 30 days.Set
PASS_MAX_DAYSto30in the/etc/login.defsfile. Use administrative rights when opening the file with the text editor. You can use thevim /etc/login.defscommand for this step....output omitted... # Password aging controls: # # PASS_MAX_DAYS Maximum number of days a password may be # used. # PASS_MIN_DAYS Minimum number of days allowed between # password changes. # PASS_MIN_LEN Minimum acceptable password length. # PASS_WARN_AGE Number of days warning given before a # password expires. #
PASS_MAX_DAYS 30PASS_MIN_DAYS 0 PASS_WARN_AGE 7 ...output omitted...
Create the
consultantsgroup with a GID of35000.Configure administrative rights to enable all
consultantsgroup members to execute any command as any user. Avoid usingvisudoto edit the/etc/sudoersfile. Instead, place the configuration file in the/etc/sudoers.ddirectory.Create the
consultant1,consultant2, andconsultant3users with theconsultantsgroup as their supplementary group.Set the
consultant1,consultant2, andconsultant3passwords toredhat.[root@serverb ~]#
passwd consultant1Changing password for user consultant1. New password:redhatBAD PASSWORD: The password is shorter than 8 characters Retype new password:redhatpasswd: all authentication tokens updated successfully. [root@serverb ~]#passwd consultant2Changing password for user consultant2. New password:redhatBAD PASSWORD: The password is shorter than 8 characters Retype new password:redhatpasswd: all authentication tokens updated successfully [root@serverb ~]#passwd consultant3Changing password for user consultant3. New password:redhatBAD PASSWORD: The password is shorter than 8 characters Retype new password:redhatpasswd: all authentication tokens updated successfullySet the
consultant1,consultant2, andconsultant3accounts to expire in 90 days from the current day.Determine the date 90 days in the future. This returned date is an example; the value that you see, to use in the following step, is based on the current date and time in your system.
[root@serverb ~]#
date -d "+90 days" +%F2022-06-08Set the account expiry date of the
consultant1,consultant2, andconsultant3accounts to the same value as determined in the preceding step. For example:[root@serverb ~]#
chage -E[root@serverb ~]#2022-06-08consultant1chage -E[root@serverb ~]#2022-06-08consultant2chage -E2022-06-08consultant3
Change the password policy for the
consultant2account to require a new password every 15 days.Additionally, force the
consultant1,consultant2, andconsultant3users to change their passwords on the first login.Set the last day of the password change to
0so that users must change the password when they first log in to the system.[root@serverb ~]#
chage -d 0 consultant1[root@serverb ~]#chage -d 0 consultant2[root@serverb ~]#chage -d 0 consultant3Return to the
workstationsystem as thestudentuser.[root@serverb ~]#
exitlogout [student@serverb ~]$exitlogout Connection to serverb closed. [student@workstation ~]$