Lockdown Lab #20 MEDIUM Linux (Ubuntu/RHEL)

Lock inactive user accounts

Lock inactive user accounts

That dormant account for a contractor who left six months ago? It’s a gold mine for an attacker. I’ve seen too many breaches start with credentials that were valid but simply forgotten.

This isn’t rocket science, folks. Inactive accounts are a massive attack surface that organizations consistently overlook. They sit there, often with old, unrotated passwords, waiting to be exploited. It’s basic hygiene, yet it’s missed.

Automatically lock accounts after 30 days of inactivity. For new users, set the default: sudo useradd -D -f 30. For existing users, apply it: sudo chage –inactive 30 . Make this a standard part of your user lifecycle management.

If you’re not doing this, you’re leaving a gaping hole. Period.

The fix

sudo useradd -D -f 30

# For existing users:

sudo chage --inactive 30 <username>

Reference: CIS Linux Benchmark 5.4.1.4

Mark this as done

Open the interactive hardening checklist and tick this off in your environment.

Open interactive checklist →

Related Posts

Restrict sudo access

How many times have we seen an attacker gain a foothold, then immediately escalate privileges because everyone has sudo access? It’s not a theoretical threat;...

lockdown-labhardeninglinuxidentity
/Shimi Cohen

Set password complexity and aging

Weak passwords are still the number one attack vector. Period. I've seen countless environments where a breach started with a simple brute-force or credential stuffing...

lockdown-labhardeninglinuxidentity
/Shimi Cohen

Enforce SSH key-based authentication

Let's talk about the lowest hanging fruit for botnets: password-based SSH. If you're still allowing it, you're not just leaving a door open; you're putting...

lockdown-labhardeninglinuxidentity
/Shimi Cohen