7

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?

1
  • The script from my answer here maybe can help you. Commented Jan 13, 2014 at 20:45

3 Answers 3

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
  • 1
    Or just use ac to get the total logint ime. It does not take idle time into account, though. Commented Jan 14, 2014 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.
0

My application LittleBrother adresses some of your requirements. It's still a work in progress so I'm always happy about people testing it and giving me feedback.

Some of the features of my application:

  • Any number of users can be monitored.

  • Each user can have a specific set of rules defining the permitted playtime.

  • Rules can be adapted to "contexts", such as the day of the week and/or a vacation schedule (currently only the German schedules are supported).

  • Play time can be restricted to a time window (from, to).

  • A maximum play time per day can be defined.

  • Users can be forced to take a break after a certain maximum session time.

  • Users can be forced to wait for a minimum break time after their activity.

  • Any number of Linux client hosts can be monitored (currently this requires users to have the same login on all machines).

  • There is a master host with a history of the activities of all users. This master host checks the rule sets and prompts the client hosts to terminate processes if required.

  • The master host offers a simple web interface for viewing the user activity over a configured history length (e.g. 7 days) and an administration page to dynamically define rule exceptions for a configured number of days into the future.

  • The web application can be run behind a proxy so that it will be accessible from away allowing remote administration after receiving calls from young users begging for more play time.

  • There is a helper application (LittleBrotherTaskbar) to display the remaining playtime of a monitored user and speak the notifications.

  • The application has international language support. Currently, 11 languages are available.

  • Downtime of a server during playtime (e.g. due to hibernation) is automatically substracted from the play time.

  • In addition to the time spent on Linux hosts the application can also monitor activity time on other devices such as smart phones or tables. It takes advantage of the fact that most modern operating systems put devices in some kind of power saving mode while they are not being used. This way, the network response (by pinging) can be used to determine the activity on those devices. In contrast to the Linux hosts, the application will not be able the terminate the activity. The play time, however, will be added to the overall playtime and hence will have an impact on the time allowed and also on the break time rules on the Linux hosts.

  • There is a Docker image available (currently for the slave only) which makes it really easy to run a slave on a Linux host with a Docker deamon available.

  • The application uses voice generation to inform the user over impending logouts. Also these spoken messages are internationalized. Optionally, users can be notified using four different popup tools. Note that this functionality of the LittleBrother application has been replaced by the LittleBrotherTaskbar.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.