How would you make sure a user can only log in during business hours from the office network?
IntermediateScenarioUsers, groups and access control
Answer
Situation read → PAM access controls by time and origin.
What I'd do →
- Time: add
account required pam_time.soto/etc/pam.d/sshd, and in/etc/security/time.conf:
sshd;*;alice;Wk0900-1800
- Origin: add
account required pam_access.soand in/etc/security/access.conf:
+ : alice : 10.20.0.0/16
- : alice : ALL
- Back it up with
Match User alice+AllowUsers [email protected].*in sshd for defence in depth.
Why → PAM account modules decide whether an authenticated user may log in.
Interview tip → Always test PAM changes with a second root session open.
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?BeginnerYour security team requires passwords to expire every 90 days for human users only. How do you implement it?Beginner