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 →
- For new users, set defaults in
/etc/login.defs:PASS_MAX_DAYS 90,PASS_MIN_DAYS 1,PASS_WARN_AGE 14. - 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
- 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.
More on Users, groups and access control
You need to onboard 50 new developers onto a shared build server, each with their own account and SSH key. How do you do it?BeginnerThree teams share one server and each needs a project directory only its members can write to, with new files staying group-owned. How do you set it up?BeginnerA junior engineer needs to restart nginx but must not get full root. How do you grant that?BeginnerAn engineer leaves the company today. What do you do with their Linux account on 30 servers?BeginnerA service account for a backup tool must exist on every server but nobody should be able to log in as it. How do you create it?BeginnerTwo developers need read access to `/var/log/app/` without being added to the `adm` or root group. How?Intermediate