Control amount of time a user may be logged in. (Parental Control)
MandrivaThis Forum is for the discussion of Mandriva (Mandrake) Linux.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
For the 4pm-6pm limitation you could use a cron script to deactivate their account at 6pm, and if they are logged in kill all processes in their name (maybe with a warning first?). Then another script at 4pm could reactive it. Not sure how comfortable you are with linux, if you need some help just post back and I'll do my best. Not sure about the time limitations though...
Re: Control amount of time a user may be logged in. (Parental Control)
Originally posted by darrensnospam ... specify the amount of time they are allowed to use the computer?
... specify the length of time a user can use a specific application?
I can think of 2 approaches, both a bit Byzantine:
"Wrap" each contolled program, including the login itself, in an enabling script that keeps track of time. If you want to track cumulative time you will have to provide variables that endure from one invocation to the next. In order to allow them (the kids) to execute but not change these script(s), you will have to learn more about sudo than I do.
Assuming you want to allow say a total of 2 hours of use anytime between 4pm & 8pm, then add time accumulating code to your "activation" cron script. Provide an on/off variable for each regulated user. Use ps aux, grep, & awk to find the time #'s you need. You will need accumulator variables here also.
Finally, I can see a situation where you might want to restrict 'Net access during homework hours. You could probably do this w/ a cron controlled web proxy. (But don't ask me how.)
I am interested in the same thing. Time limitations, regulating the amount of time, and web access during homework time. I have also reviewed dansguardian and will be trying that soon. I would be interested in seeing your results as well.
I guess no one ever found a way to make a time limitation on one's unix box... I myself have a linux box in our place, which is available for everyone in the house (we're like 12), and everyone got their own username, but what I am missing is the time control. Let's say each person gets max an hour every day. Isn't there a program on the web that can handle things like that?
Please give us more information about this PAM that comes w/ Mandriva & its ability to to time limit users. A URL or 2 would be ideal. I am sure all of us subscribing to this thread would like to hear about this.
You might be able to write a script that works with the output of last. You'd have to loop through and add up a user's entries for a date, then take the last entry and calculate the difference between it and the current time (periodically, through cron every 5 minutes?).