Skip to main content

Configure a Password Complexity Policy

Hands-On Lab

 

Photo of

Training Architect

Length

00:30:00

Difficulty

Intermediate

In this lab, we will create a password complexity policy that will require users to enter a password that meets our defined password requirements when creating a new password. Password policies help us guarantee passwords used on our systems are secure passwords.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Configure a Password Complexity Policy

Introduction

In this lab, we will create a password complexity policy that will require users to enter a password that meets our defined password requirements when creating a new password. Password policies help us guarantee passwords used on our systems are secure passwords.

Solution

  1. Begin by logging in to the lab server using the credentials provided on the hands-on lab page:

    ssh cloud_user@PUBLIC_IP_ADDRESS
  2. Become the root user:

    sudo su

Configure a Password Complexity Policy

  1. To create the password requirements in the policy, we need to edit the /etc/security/pwquality.conf file and include the following:

    minlen = 12  
    maxrepeat = 2  
    minclass = 4  
    ucredit = -3  
    dcredit = -3  
    badword = password, pass, word  

    > Note: Be sure to uncomment the values as you set them. The badword value will need to be added at the bottom of the file.

Put the Password Complexity Policy into effect

  1. In order to put the new policy into effect, we need to add the following line to the /etc/pam.d/passwd file:

    password    required    pam_pwquality.so retry=3
    • This line should be inserted as the first line with the word password, the third uncommented line in the default configuration of the file.

Conclusion

Congratulations — you've completed this hands-on lab!