-   Mandriva (
-   -   Control amount of time a user may be logged in. (Parental Control) (

darrensnospam 08-31-2005 12:58 AM

Control amount of time a user may be logged in. (Parental Control)
I'm wondering if there is a way to control the amount of time a user can be logged into their account.

I want to specify certain hours in the day that my kids can use the computer. For example, 4pm to 6pm. Thoughts on how to do this?

Also, would it be possible instead of specifying the hours inwhich they can use the computer to specify the amount of time they are allowed to use the computer?

Anyway to specify the length of time a user can use a specific application?

- darrensnospam

infinity42 08-31-2005 05:17 AM

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...

archtoad6 08-31-2005 12:34 PM

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:
  1. "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.
  2. 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.)

darrensnospam 09-01-2005 09:06 PM

Thanks for the leads, archtoad6 & infinity42.

I'll table development at this point if/when I do create something, I'll be certain to share it. If I find something ready made, I'll post back and let you know what I found.

I've reviewed dansguardian and I'll be testing that out. I believe that it allows for controling net access during certain periods of time.

- darrensnospam

archtoad6 09-03-2005 01:52 PM

I Look fwd. to seeing your results.

jpuhalski 09-08-2005 12:43 PM

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.

r4f 02-17-2006 10:11 AM

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?

simcox1 02-17-2006 02:28 PM

There's a program called PAM which comes with Mandriva. I don't know a lot about it but I'm pretty sure that's exactly what it's used for.

archtoad6 02-18-2006 10:06 AM

More info, please.
  1. The only PAM in Linux I ever heard of is the "Pluggable Authentical Modules" facility. While it is conceivable that it could be used for this purpose, I have never heard of it being used for this.
  2. I have done the following Google Linux searches & found nothing on point:
  3. 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.

simcox1 02-18-2006 10:19 AM

That's a link to tldp. The section on PAM.

simcox1 02-18-2006 10:25 AM

I think PAM is pretty complicated, there must be an easier way. But there's a PAM module called which does exactly what you're looking for.

simcox1 02-18-2006 10:57 AM

Another link.

bobbelfield 02-18-2006 05:31 PM

Dont seem to do the job
Extracts from "pam_time"
"Note, currently there is no daemon enforcing the end of a session. This needs to be remedied."

gilead 02-18-2006 06:01 PM

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?).

I haven't tried it yet though...

All times are GMT -5. The time now is 11:18 PM.