Sunday, 19 November 2017

Parental control in Linux

Having small children, I needed to find a way to control how much time they spent daily using the computer.

The page https://wiki.archlinux.org/index.php/Parental_Control suggests timekpr and timoutd but both seem to be obsolete, since I couldn't make them work properly.

In the end, the solution that fits me is to use both PAM and Workrave.


  • PAM (http://www.linux-pam.org/) "is a suite of shared libraries that enable the local system administrator to choose how applications authenticate users", and there is a module called pam_time that "restricts access to a system and or specific applications at various times of the day and on specific days". So, with this I can limit access to the computer to only, for example, the weekends.

  • Workrave (http://www.workrave.org/). Workrave is originally designed to assist "in the recovery and prevention of Repetitive Strain Injury (RSI). The program frequently alerts you to take micro-pauses, rest breaks and restricts you to your daily limit." 


PAM is easy to configure and the children cannot stop it, but Workrave is not meant as a parental control software, so by default it shows a window, which the children could easily close in order to avoid the prescribed time limit. In order to fix this, I just make Workrave not to show in the Icon Tray, and just to open as a regular window, which then I hide from the taskbar with wmctrl. I create the following minimal script, which I configure to start up automatically with each session, so Workrave starts in the background, and the children cannot easily close it (when they learn a bit more about Linux they will easily figure out how to stop it, but I still have a few years until that happens!).

#!/bin/bash
/usr/sbin/workrave --sm-client-disable &
sleep 1
wmctrl -r "Workrave" -b add,skip_taskbar

When they reach the daily limit, Workrave will show them a warning and give them 30 seconds before the session is blocked (I would like to give them perhaps 5 minutes before the session is blocked, but for the moment I didn't figure out how to change this).

The Workrave configuration I used can be seen in the following images:





No comments: