Configure an Account Lockout Policy

30 minutes
  • 3 Learning Objectives

About this Hands-on Lab

In this lab, we will use the Pluggable Authentication Module (PAM) to create an account lockout policy. Account lockout policies are crucial in preventing brute force password attacks from being successful.

*This course is not approved or sponsored by Red Hat.*

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install PAM
  1. To install PAM, run the following command:

    sudo yum install -y pam-devel
Create an Account Lockout Policy
  1. To set up an account lockout policy that will lock for 15 minutes after 3 consecutive failed logins and includes the root account in the policy, you’ll need to add the following lines to both /etc/pam.d/password-auth and /etc/pam.d/system-auth:

    auth        required preauth silent audit deny=3 even_deny_root unlock_time=900
    auth        [default=die] authfail audit deny=3 even_deny_root unlock_time=900
    • The first line above should be the second uncommented line in the files
    • The second line above should be the fourth uncommented line in the files.
  2. Next, we need to add the following line as the first line in the account section of the password-auth and system-auth files:

    account     required 
Test the Account Lockout Policy
  1. Open a new shell to your host
  2. Enter incorrect login credentials for cloud_user
  3. Run the command faillock and you now see the recorded failed logins

Additional Resources

In order to further secure Red Hat servers, you've been tasked to configure a failed login policy that will lock accounts out for 15 minutes after 3 consecutive failed login attempts. Be sure the root account is included in this policy.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?