Interview Prep/Linux/Users, groups and access control

Your security team requires passwords to expire every 90 days for human users only. How do you implement it?

BeginnerScenarioUsers, groups and access control
Answer

Situation read → Password aging policy, applied to existing and future users.

What I'd do →

  1. For new users, set defaults in /etc/login.defs: PASS_MAX_DAYS 90, PASS_MIN_DAYS 1, PASS_WARN_AGE 14.
  2. For existing humans (UID >= 1000):
awk -F: '$3>=1000 && $3<65534 {print $1}' /etc/passwd | xargs -I{} sudo chage -M 90 -m 1 -W 14 {}
chage -l alice
  1. Exclude service accounts and key-only accounts where expiry would just break automation.

Why → login.defs only affects accounts created afterwards; chage fixes the existing ones.

Interview tip → Note that modern guidance (NIST 800-63B) prefers strong passwords plus MFA over forced rotation, but you implement what policy says.

All Linux questions Roadmap: Linux

More on Users, groups and access control