Suppose that some person is insomniac because of a bad habit of chatting on the IRC every night until 3AM. That completely ruins this person's life because he is unable to wake up on time to attend his exams, because he will be fully exhausted everyday and will feel depressive.
That person is conscious of this bad behaviour, and would accept any help including installing a software on his own computer granting me admin privileges to install it.
Do you know of such a software that ideally would:
- Would prevent use of the computer at certain time ranges, let's say 11PM — 6AM
- Would gracefully shutdown the computer at the beginning of that time range (not killing all the applications brutally), and shutdown it if the user attempts to switch it back on
- Would warn 10 minutes beforehand
- Could occasionally be disabled if I give a one-time password to that person?
That person uses Linux, and I am curious of knowing what is available for that purpose. It is kind of a parental control, but not for a child.
Thank you for your advice.
Answer
See Restrict users' access on Linux systems.
The idea is to use Linux-PAM to control timed access for users to services:
Using the pam_time module, we can set access restrictions to a system and/or specific applications at various times of the day as well as on specific days or over various terminal lines. Depending on the configuration, you can use this module to deny access to individual users based on their name, the time of day, the day of week, the service they’re applying for, and their terminal from which they’re making the request.
In the file
/etc/security/time.conf
, here’s the syntax for a rule:
services;ttys;users;times
- The first field — services — is a logic list of PAM service names.
- The second field — tty — is a logic list of terminal names.
- The third field — users — is a logic list of users or a netgroup of users.
- The fourth field — times — indicates the applicable times.
Here’s an example of a typical set of rules:
login ; * ; !bobby ; MoTuWeThFr0800-2000
login ; * ; !root ; !Al0000-2400
http ; * ; !bobby ; MoTuWeThFr0800-2000
http ; * ; !root; !Al0000-2400These rules restrict user bobby from logging on between the hours of 0800 and 2000, and they also restrict Internet access during these hours. Root would be able to logon at any time and browse the Internet during all times as well.
Comments
Post a Comment