- Lab
- A Cloud Guru
Working with Linux Accounts and Password Policies
In this lab, we will learn how to configure Linux accounts and security policies. Specifically, we will set password requirements, configure account lockout settings, and create a temporary user account that will expire on a pre-determined date.
Path Info
Table of Contents
-
Challenge
Set up password requirements on a Linux host.
Set the minimum password length to 12 characters:
- Run the command
sudo nano /etc/pam.d/common-password
. - At the end of the first uncommented line (line 25) add
minlen=12
, one space aftersha512
. - Save the file and exit nano.
Set the maximum password age to 180 days and the minimum password age to 3 days:
- Run the command
sudo nano /etc/login.defs
. - Search for
99999
(press Ctrl + W to search). - Replace
99999
with180
. - On the next line down, replace the
0
with3
. - Save the file and exit nano.
- Run the command
-
Challenge
Configure the account lockout settings on a Linux host.
Configure accounts to lock out after 3 failed logins and remain locked out for 10 minutes. Do not configure the root account to lock out after any amount of failed login attempts.
- Run the command
sudo nano /etc/pam.d/common-auth
. - Add a line above the first non-commented line and add the following code:
auth required pam_tally2.so onerr=fail deny=3 unlock_time=600 audit
- Run the command
-
Challenge
Create a temporary user account.
The temporary account name should be
contractor1
, and it should expire one week from today.- Run the following command:
sudo adduser contractor1
- Provide a password for the account.
- Run the following command (replace
<YYYY-MM-DD>
with the date for one week from today):
sudo chage -E "<YYYY-MM-DD>" contractor1
- Verify that the account expiration is correctly configured by running the following command and checking the Account expires date:
sudo chage -l contractor1
What's a lab?
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.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.