6

I need a solution that allows me to control the time that each user spend on the computer, excluding idle time (some kind of parental control). I've tried timekpr, but it doesn't work on Ubuntu 13.10. pam_time is not what I'm looking for...

Here is how my situation looks like in practice:

There are several user's accounts in the system, let's call them U1, U2 and U3. I would like to know how long and at what time each of them was active, BUT if i. e. U2 doesn't perform any operations (just idle logged in) or lock his account without logging off, it shouldn't be counted against the total time spent by him on the computer. If user exceed the time limit assigned to his account, I would like to be able to run a bash script (and the same when he tried to use a computer in some specified hours).

My computer works as a server, so more than one user can use it at the same time. Users work in graphical mode (Unity, X Window System) without using the terminal.

Is there any third-hand software, a system command, some suggestions what can I use developing my own solution, et cetera?

  • The script from my answer here maybe can help you. – Radu Rădeanu Jan 13 '14 at 20:45
4
`w U1` - login informations for example for user U1 you can see in output something like this
User     tty           login@  idle   JCPU   PCPU  what

also you can make a bash script and put in crontab for example to be run a few times per one day, with varibles w U1, w U2, w U3 and make some otput into file also

`/var/run/utmp` - List of current login sessions.


 `/var/log/wtmp` - List of previous login sessions
`/var/log/btmp` - List all the bad login attempt
  • 1
    Or just use ac to get the total logint ime. It does not take idle time into account, though. – Jenny D Jan 14 '14 at 5:52
1

I don't have any answer for limiting total amount of time spent. For limiting based on hours of the day, though, pam_time is probably what you want.

From the man page:

   The pam_time PAM module does not authenticate the user, but instead it
   restricts access to a system and or specific applications at various
   times of the day and on specific days or over various terminal lines.
   This module can be configured to deny access to (individual) users
   based on their name, the time of day, the day of week, the service they
   are applying for and their terminal from which they are making their
   request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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