This course is using an outdated version of the technology and is now considered to be Legacy content. It will be removed from our catalog on June 28, 2024. Please be sure to complete your course and finish any remaining labs before that date. We recommend moving to version 9.2, which is the latest version currently available.
In this exercise, you will configure password complexity requirements that will be enforced by PAM when passwords are changed.
Outcomes
You should be able to:
Adjust password quality requirements with authconfig.
Review and adjust password quality requirements by configuring /etc/security/pwquality.conf.
Confirm that the workstation and serverc machines are started.
Log in to workstation as student using student as the password.
On workstation, run lab pam-password setup to verify that the environment is ready.
[student@workstation ~]$lab pam-password setup
Set the password policy on your system to require a password of at least 12 characters, including at least one symbol and one digit.
Log in to serverc as student.
No password is required.
[student@workstation ~]$ssh student@serverc[student@serverc ~]$
Use the sudo -i command to switch identity to the root user.
Use student as the password.
[student@serverc ~]$sudo -i[sudo] password for student:student[root@serverc ~]#
Verify that the default PAM configuration already includes a rule to call the pam_pwquality module.
[root@serverc ~]#cd /etc/pam.d[root@serverc pam.d]#grep pam_pwquality.so system-auth password-authsystem-auth:password requisitepam_pwquality.sotry_first_pass local_users_only retry=3 authtok_type= password-auth:password requisitepam_pwquality.sotry_first_pass local_users_only retry=3 authtok_type=
Use the authconfig --passminlen=12 --update command to set the password length.
[root@serverc pam.d]#authconfig --passminlen=12 --update[root@serverc pam.d]#
Alternatively, you could directly edit the /etc/security/pwquality.conf configuration file.
To define the more advanced password requirements, edit the /etc/security/pwquality.conf file.
Set the dcredit and ocredit parameters to -1.
pam_pwquality uses negative values to enforce a minimum number of characters of a class.
[root@serverc pam.d]#vim /etc/security/pwquality.conf...output omitted... minlen = 12 minclass = 1 maxrepeat = 0 maxclassrepeat = 0 lcredit = 0 ucredit = 0 dcredit =-1ocredit =-1
Verify that you meet the new requirements by setting the student user password to:
L1b3r8yourself - should not work (1 digit, 14 characters, but no symbol)
i<3bearclaws - should work (1 symbol, 1 digit, and 12 characters)
Log out from the root account.
[root@serverc pam.d]#logout[student@serverc ~]$
Use the passwd command to set the password for the student user.
[student@serverc ~]$passwdChanging password for user student. Changing password for student. (current) UNIX password:studentNew password:L1b3r8yourselfBAD PASSWORD: The password contains less than 1 non-alphanumeric characters New password:i<3bearclawsRetype new password:i<3bearclawspasswd: all authentication tokens updated successfully.
Use sudo -i to become root again and change the student password back to student.
If the sudo command asks for a password, use the new one.
[student@serverc ~]$sudo -i[sudo] password for student:i<3bearclaws[root@serverc ~]#passwd studentChanging password for user student. New password:studentBAD PASSWORD: The password is shorter than 8 characters Retype new password:studentpasswd: all authentication tokens updated successfully.