Ubuntu – How to control the time that users spend on

linuxtimeUbuntuusers

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?

Best Answer

`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
Related Question