LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Restrict computer time for kids (https://www.linuxquestions.org/questions/linux-software-2/restrict-computer-time-for-kids-4175507561/)

propofol 06-10-2014 01:04 AM

Restrict computer time for kids
 
Just a note for anyone with kids who have a similar problem.

I have an Ubuntu 14.04 PC for the kids with a few educational programs as well as Steam & a few games. Unfortunately they have started spending way to much time with this rather than doing homework so I started looking at ways of limiting usage. I found it surprisingly hard to get something that was easy to set up. I looked at pam_time, but this seemed very involved.

I eventually came across this: kidtimer. This little program was very easy to install & it works perfectly.

Regards,
Stefan

TenTenths 06-10-2014 03:20 AM

Other possible solutions:

Buy lockable cabinet, put keyboard, mouse, power cables in cabinet, lock cabinet.
Change computer or WiFi password, "do all chores / homework" for password.

:)

Glennzo 06-10-2014 03:36 AM

How about this? Since you are the parent, you tell your child that "computer time is up. Go do something else". Eliminates the need for installation and configuration of software.

pan64 06-10-2014 03:39 AM

actually it does not work, because he (the child) is at home and I'm working now.

TenTenths 06-10-2014 03:41 AM

Removable hard disk caddy and take the disk with you? :)

Glennzo 06-10-2014 03:43 AM

Well, I guess I assumed that this interaction takes place when everyone is home and that the kids are very young.

pan64 06-10-2014 03:56 AM

Why? when children are at home (not in school) and they are free to use the net and the pc for an hour or two day by day - for example he can chat with me, look for interesting info, do the homework, but cannot play (shoot bad guys) all day long ...

propofol 06-11-2014 06:51 PM

Quote:

Originally Posted by Glennzo (Post 5185539)
How about this? Since you are the parent, you tell your child that "computer time is up. Go do something else". Eliminates the need for installation and configuration of software.

I suspect you do not have kids! :)

allend 06-12-2014 09:22 AM

:) Your problems are just beginning!
Quote:

for example he can chat with me, look for interesting info, do the homework, but cannot play (shoot bad guys) all day long ...
.. and then chat with friends about how to get around parental restrictions. They are a savvy lot, this generation that have grown up in a world where computers have always existed.
.. and then look for interesting info like the shape of the naked female body and various contortions. Then they get smart and start clearing web browser history.
.. and then do the the homework by finding a friend who has already done it and is prepared to share a copy.
.. and then play on-line games to shoot bad guys ad infinitum because your internet filters are child's play or they have found a new proxy server or they have been given a bootable USB stick.

Time based restriction will work for a while, then 'over the shoulder' restrictions will work for a while, (i.e. access where usage can be physically monitored) but then there are homework assignments that need research and when completed need to be uploaded to school servers and ...

From a security viewpoint, physical access means game over.

pan64 06-12-2014 11:57 AM

Quote:

Originally Posted by allend (Post 5187031)
:) Your problems are just beginning!

Actually not, it is another kind of game. At least in my case. You can say I know much more about internet and security than the "usual" average. So my children have a really hard job to do "bad things". One of them simply went to his friends to see "interesting" pages. But it is a learning curve to the other. So he will try this and will be restricted, and try that and restricted again, and finally he will know a lot about linux, security, proxy, firewall and other stuff.

Beryllos 06-12-2014 02:07 PM

Quote:

Originally Posted by propofol (Post 5185494)
Just a note for anyone with kids who have a similar problem.

I have an Ubuntu 14.04 PC for the kids with a few educational programs as well as Steam & a few games. Unfortunately they have started spending way to much time with this rather than doing homework so I started looking at ways of limiting usage. I found it surprisingly hard to get something that was easy to set up. I looked at pam_time, but this seemed very involved.

I eventually came across this: kidtimer. This little program was very easy to install & it works perfectly.

Regards,
Stefan

The thread title got my attention, because this is something I have spent a lot of time on, and it is still a bit of trouble. I developed my own system, which has some similarity to kidtimer. I use pam_time to restrict the hours the child can log in. A cron job runs every minute, and parses the output of ck-list-sessions to determine if any user is active. If so, it increments a counter for that user. When the counter gets to certain points, it uses aplay to play a notification sound, and zenity to send a notification message to the screen (5 minute warning, automatic logout in 1 minute, logging out now), and gnome-session-quit to log the child out.

Problems with my system: If the child's time runs out on one computer, he/she may walk over to another computer and log in there. If the child needs more computer time to do homework, I have to manually adjust the time limit setting.

Problems in general: When they are supposed to be doing homework on the computer, they are usually checking facebook, twitter, etc., in the background.

I'll try kidtimer, but I would like to develop my system further, if I have the time.

schneidz 06-12-2014 02:27 PM

Code:

[root@hyper ~]#  crontab -l
0 17 * * * /sbin/shutdown -h 5
0 16 * * * mv /etc/resolv.conf /etc/resolv.bak


propofol 06-17-2014 01:06 PM

Quote:

Originally Posted by Beryllos (Post 5187191)
...
I use pam_time to restrict the hours the child can log in. A cron job runs every minute, and parses the output of ck-list-sessions to determine if any user is active. If so, it increments a counter for that user. When the counter gets to certain points, it uses aplay to play a notification sound, and zenity to send a notification message to the screen (5 minute warning, automatic logout in 1 minute, logging out now), and gnome-session-quit to log the child out.
...

This sounds like an interesting way of doing it. Would it be possible to give a short summary of how you configured pam_time?

Regards,
Stefan

Beryllos 06-17-2014 11:54 PM

Quote:

Originally Posted by propofol (Post 5189405)
This sounds like an interesting way of doing it. Would it be possible to give a short summary of how you configured pam_time?

When I started working on this problem, I searched the web, but I didn't know the right keywords. Web searches for words like "linux parental control" were not very productive. Now that I know it involves pam, I can tell you to search for "pam restrict login time" or similar words. That pretty much gives you the answer. Additional insight can be gained by the man pages for pam_time, time.conf, and perhaps pam(7).

This is my method, more or less:
  1. Determine which service (or services) you wish to restrict.
    My children always log in by the graphical login screen. The corresponding service on my computer is gdm3 (Gnome Display Manager 3). For KDE, I think the service would be kdm (KDE Display Manager). For other channels of access, one might use services called login, sshd, or perhaps others.
  2. Edit the appropriate PAM configuration file.
    On my system, PAM is configured by files in the /etc/pam.d directory. I add the following line to the file /etc/pam.d/gdm3:
    Code:

    account required pam_time.so
    I put this line at the end of the file, but it seems to work just as well if it is inserted elsewhere.

    If you don't have a /etc/pam.d directory, then the configuration file is /etc/pam.conf, and you add lines like the following, where the first field is the name of the service:
    Code:

    gdm3 account required pam_time.so
  3. Set the time restriction rules in the file /etc/security/time.conf
    Here is an example similar to my /etc/security/time.conf (usernames have been changed for anonymity):
    Code:

    * ; * ; alfonso ; !Al0000-2400    # can never log in
     * ; * ; bernard ; Al0000-2400    # can always log in
     * ; * ; corrina ; Wk1530-1900|Wd1300-2100    # Mon-Fri 15:30-19:00, Sat-Sun 13:00-21:00.

    The original /etc/security/time.conf file contains instructions on time.conf syntax.

    If a user is not listed in time.conf, that user may log in at any time (no time restrictions).
With this configuration, users can login by gdm only at the specified times. However, it does not log them out. I am not sure if it is possible to force a logout with pam_time. That is why I used gnome-session-quit to force a logout, as I mentioned in my previous post.

propofol 06-19-2014 01:40 AM

Quote:

Originally Posted by Beryllos (Post 5189660)
When I started working on this problem, I searched the web, but I didn't know the right keywords. Web searches for words like "linux parental control" were not very productive. Now that I know it involves pam, I can tell you to search for "pam restrict login time" or similar words. That pretty much gives you the answer. Additional insight can be gained by the man pages for pam_time, time.conf, and perhaps pam(7).

This is my method, more or less:
....

Thanks for the information. I also found that a "linux" + "parental control" google search did not help that much although I did eventually find the kidtimer script. We have a pc in the living room and I thought we would just keep an eye on them but it is not that easy. My daughter typed her name plus ".com" in the address bar and promptly got onto a XXX site. Now I have added openDNS and a weekly updated /etc/hosts file.

Regards,
Stefan

Thomas Baeckeroot 09-10-2017 07:54 AM

A solution: bash script that logs-off user once his daily time is over (4 lines to install)
 
Hi all,

I just made an answer available easily. Code is explained on thread http://forums.linuxmint.com/viewtopic.php?f=213&t=77687 . In short: a limit configured in minutes per day, a cron job every minute, a message to user to keep him informed and a forced logoff.

To download and install this, open a Terminal and run the commands below:
Code:

cd /tmp/
git clone https://github.com/Thomas-Baeckeroot/ParentalControl.git
cd ParentalControl/
./install.sh

Administrator password will be requested during the installation process (to install the cron job, to copy the script, …). From there you will be guided for the configuration (number of minutes for each user). There is also an ./uninstall.sh at the same place just in case. It is build to work with all Ubuntu based distro (Mint, etc… probably all debian also). If any issue occurs please let me know, including system version and graphical environment in comments:
Code:

uname -a
echo $XDG_CURRENT_DESKTOP

PS: At the time I started this script (~2012), "kidtimer" solution from grover66 and Jim Dunphy did not exist yet so I haven't checked their solution, it looks to do the same: https://github.com/JimDunphy/kidtimer .


Thomas Baeckeroot

Marcus67 04-20-2019 06:51 AM

New Parental Control Application for Debian Linux
 
I've just released a beta version of my new application LittleBrother that is able to monitor play time on Linux machines. Test users are welcome to try the Debian package. Instructions on how to download and use it can be found here: https://github.com/marcus67/little_brother. The installation may still be a little rough, though. These are the features of the 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 miniumum 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.
  • The application has international language support. Currently English and German translations are provided. Users are invited to provide translations for other languages.
  • The application uses voice generation to inform the user over impending forced logouts. Also these spoken messages are internationalized.
  • 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.

ondoho 04-21-2019 04:51 AM

sounds ambitious.
I hope it works well!
is it distro-independent?
can you explain in a few simple words how it works under the hood?
and at what age will kids be able to circumvent it? ;)

Marcus67 04-22-2019 03:32 PM

Description of architecture will follow
 
Quote:

Originally Posted by ondoho (Post 5987153)
sounds ambitious.
I hope it works well!
is it distro-independent?
can you explain in a few simple words how it works under the hood?
and at what age will kids be able to circumvent it? ;)

Currently, the application is available as a Debian package only. However, the effort to make it available to other distributions should be small.

Your commend reminds me of the fact, that I wanted to write a short technical description of the "architecture" if that word is applicable for such a small application. I will do this as one of my next chores. This is the architecture in a nutshell: https://github.com/marcus67/little_b...RCHITECTURE.md.

The children would require a sufficient knowledge of Linux processes and most likely root access or the admin password must have been compromised.

bgstack15 04-23-2019 06:56 AM

This sounds fascinating. Thank you for sharing this! Do you expect that a person could modify this to have a popup, instead of an audible message?

Marcus67 04-23-2019 04:58 PM

Popup is already on the issue list
 
Quote:

Originally Posted by bgstack15 (Post 5987724)
This sounds fascinating. Thank you for sharing this! Do you expect that a person could modify this to have a popup, instead of an audible message?

Actually, I just transferred some issues to GitHub and voila: https://github.com/marcus67/little_brother/issues/6 :-)

ondoho 04-26-2019 11:30 AM

Quote:

Originally Posted by Marcus67 (Post 5987545)
I wanted to write a short technical description of the "architecture" if that word is applicable for such a small application. I will do this as one of my next chores. This is the architecture in a nutshell: https://github.com/marcus67/little_b...RCHITECTURE.md.

ok, thanks!
i think this:
Quote:

applies configured rules
would need to be expanded: what rules, and how are they "applied".

I hope you get more contributors!


All times are GMT -5. The time now is 07:44 PM.