0

This question already has an answer here:

I'm looking for an automatic way to lock out our home computer during certain pre-scheduled times of the day. Rather than rolling my own script for doing this, is there some off-the-shelf software for this use-case?

In case this matters, the solution need not be absolutely bullet-proof. I just need to raise the "activation barrier" just high enough to discourage casual use of the computer.

marked as duplicate by Jeremy Kerr, Community Jun 3 '15 at 1:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

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
0

One module would be pam_time.

Your question may be answered by How do I restrict my kids computing time.

Not the answer you're looking for? Browse other questions tagged or ask your own question.