Intro
Enabling parental controls is pretty simple if you can live with using a curated free service like OpenDNS Familyshield.
My reason for setting this up was because the kids tended to surf Youtube more than actually doing what they were supposed to...
I also installed and enabled timekpr-next to control the screentime.
Both kids use a plain vanilla Kubuntu-install, the latest LTS version.
Enabling OpenDNS
OpenDNS Familyshield IP's to be used
208.67.222.123
208.67.220.123
Checking IP-stuff before we do anything.
# nmcli connection show
# nmcli device show
We must disable the automatically set DNS-addresses from DHCP-server in order to set the OpenDNS IP's.
# nmcli conn modify "Trådbunden anslutning 1" ipv4.ignore-auto-dns yes
Then we set the OpenDNS IP's and restart the network manager, which incidentally flushes the DNS cache also.
# nmcli conn modify "Trådbunden anslutning 1" ipv4.dns "208.67.222.123 208.67.220.123"
# systemctl restart NetworkManager
After setting the OpenDNS, we can check the setting again.
# nmcli conn show "Trådbunden anslutning 1" | grep dns:
Flushing the DNS-cache again, if needed and showing some stats.
# systemd-resolve --flush-caches
# systemd-resolve --statistics
Timekpr-next
These are quick and dirty command references for configuring timekpr-next on the kid's computers.
root@ceres3:~# /usr/bin/timekpra
WARNING: Timekpr-nExT administration utility was asked to run in GUI mode, but no displays are available, thus running in CLI...
The command is incorrect: /usr/lib/python3/dist-packages/timekpr/client/timekpra.py /usr/bin/timekpra
---=== NOTICE ===---
*) numeric time values are in seconds
*) hours are numbered according to ISO 8601 (i.e. 24h clock, format: 0-23)
*) weekdays are numbered according to ISO 8601 (i.e. Monday is the first day, format: 1-7)
The usage of Timekpr-nExT admin client is as follows:
--help ==> print help, example:
timekpra --help
--userlist ==> get saved user list from the server, example:
timekpra --userlist
--userinfo ==> get user configuration and time information from the server, example:
timekpra --userinfo 'testuser'
--setalloweddays ==> set allowed days for the user, example:
timekpra --setalloweddays 'testuser' '1;2;3;4;5'
--setallowedhours ==> set allowed hours for the specified day, or "ALL" for every day, optionally specify start and end minutes in brackets like this [x-y], additionally specify ! in front of hour if it doesn't have to be accounted (free time for user), example:
timekpra --setallowedhours 'testuser' 'ALL' '7;8;9;10;11[00-30];!14;!15;17;18;19;20[00-45]'
--settimelimits ==> set time limits for all allowed days, the number of values must not exceed the allowed days for the user, example:
timekpra --settimelimits 'testuser' '7200;7200;7200;7200;10800'
--settimelimitweek ==> set time limit per week, example:
timekpra --settimelimitweek 'testuser' '50000'
--settimelimitmonth ==> set time limit per month, example:
timekpra --settimelimitmonth 'testuser' '200000'
--settrackinactive ==> set whether to track inactive user sessions, example:
timekpra --settrackinactive 'testuser' 'false'
--sethidetrayicon ==> set whether to hide tray icon and prevent notifications, example:
timekpra --sethidetrayicon 'testuser' 'false'
--setlockouttype ==> set restriction / lockout type ("lock" - lock session, "suspend" - suspend the computer, "suspendwake" - suspend and wake up, "terminate" - terminate sessions, "shutdown" - shutdown the computer), examples:
timekpra --setlockouttype 'testuser' 'terminate'
timekpra --setlockouttype 'testuser' 'suspendwake;7;18'
--settimeleft ==> set time left for the user at the current moment of time: "+" (add time), "-" (subtract time), "=" (set exact time available), example (add one hour):
timekpra --settimeleft 'testuser' '+' 3600
--setplaytimeenabled ==> set whether PlayTime is enabled for the user, example:
timekpra --setplaytimeenabled 'testuser' 'false'
--setplaytimelimitoverride ==> set whether PlayTime must be accounted instead of normal activity, example:
timekpra --setplaytimelimitoverride 'testuser' 'false'
--setplaytimealloweddays ==> set allowed days for PlayTime activities, example:
timekpra --setplaytimealloweddays 'testuser' '1;2;3;4;5'
--setplaytimelimits ==> set PlayTime limits for all allowed days, the number of values must not exceed the allowed PlayTime allowed days for the user, example:
timekpra --setplaytimelimits 'testuser' '1800;1800;1800;1800;3600'
--setplaytimeactivities ==> set PlayTime activity process masks, for which the time is accounted, example:
timekpra --setplaytimeactivities 'testuser' 'DOOMEternalx64vk.exe[Doom Eternal];csgo_linux[CS: GO];firefox[Firefox browser]'
--setplaytimeleft ==> set PlayTime left for the user at the current moment of time: "+" (add time), "-" (subtract time), "=" (set exact time available), example (add one hour):
timekpra --setplaytimeleft 'testuser' '+' 3600
I've found it quite practical to set up three Jenkins jobs for each child's computer:
- A job to temporarily add more time.
- A job to add more weekly time, for eg vacation weeks.
- A job to reset the times to the normal values for school weeks.
The Jenkins jobs simplifies the time management to a great extent! You don't have to ssh in to a childs computer, find the correct command and check to make sure the time was changed as expected.
Also, it adds a certain amount of plausible deniability that one kid got more time than the other, as I can point to a executed Jenkin job.
You know what accusation I speak of:
"He got more time than I did!
<me pointing to the Jenkins console output>
"Nope, look here, see?". :-D
References
https://support.opendns.com/hc/en-us/articles/227988627
https://adam.younglogic.com/2019/05/using-nmcli-to-set-nameservers/
https://askubuntu.com/questions/980382/how-do-i-to-set-the-dns-server-for-a-device-using-nmcli
https://www.linuxuprising.com/2019/11/timekpr-next-is-linux-parental-control.html
https://launchpad.net/timekpr-next