It looks like you can implement this through the standard Linux authentication system (called pam
- Pluggable Authentication Modules). This (amongst other things) is responsible for checking if users can log in.
Within the pam system, there's a module called pam_time
, which allows you to set restrictions for logins based on the time of day. This is controlled by the file /etc/security/time.conf
.
Something like this could work:
login;tty*;!kjo;Wd1500-2000
- to prevent everyone except the kjo
user from logging-in (ie, using the login
service, on any tty*
terminal) from 3pm to 8pm on weekdays. Be careful though, I haven't tested this!
There is quite a bit of documentation about the configuration format in the /etc/security/time.conf
file, and check the pam_time
and time.conf
manual pages for more information:
man pam_time
man time.conf
Once you've configured time.conf to your liking, you'll need to uncomment the following line in your /etc/pam.d/login.conf
:
account requisite pam_time.so