Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

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.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Beginner
Duration
Clock icon 30m
Published
Clock icon Mar 18, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Set up password requirements on a Linux host.

    Set the minimum password length to 12 characters:

    1. Run the command sudo nano /etc/pam.d/common-password.
    2. At the end of the first uncommented line (line 25) add minlen=12, one space after sha512.
    3. Save the file and exit nano.

    Set the maximum password age to 180 days and the minimum password age to 3 days:

    1. Run the command sudo nano /etc/login.defs.
    2. Search for 99999 (press Ctrl + W to search).
    3. Replace 99999 with 180.
    4. On the next line down, replace the 0 with 3.
    5. Save the file and exit nano.
  2. 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.

    1. Run the command sudo nano /etc/pam.d/common-auth.
    2. 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
  3. Challenge

    Create a temporary user account.

    The temporary account name should be contractor1, and it should expire one week from today.

    1. Run the following command:
    sudo adduser contractor1
    
    1. Provide a password for the account.
    2. Run the following command (replace <YYYY-MM-DD> with the date for one week from today):
    sudo chage -E "&lt;YYYY-MM-DD>" contractor1
    
    1. Verify that the account expiration is correctly configured by running the following command and checking the Account expires date:
    sudo chage -l contractor1
    

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

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.

Start learning by doing today

View Plans