My son received a new laptop this past christmas, primarily for usage at his new school... And now that he has his own laptop, he's stoked to have Steam installed.
But the wife wants me to remove Steam, because the laptop is primarily for school usage... I'd rather not do that, if I don't have to.
Is there a way I can restrict or otherwise limit access to Steam? Perhaps a password on Steam itself, or set times during which it can be run?
Ideally, it has to be something pretty simple to use because my work often keeps me away from home (and computers, and telecommunications and...) for long periods of time and whilst my wife is not as comfortable around computers as I am, easier to use is far, far better.
Surely there's something out there that can achieve this task?
From my own experience restricting access to computer games is one of the most challenging tasks in educating our kids. Of course we parents want them to use their computers mainly for school but this heavily conflicts with the kid's intentions. They will hate us for giving them hardware usable for school only.
And of course we also want them to learn how to use their computer in a sensible way, including how to use it not only for work but also for leisure. This includes gaming and watching videos.
Unfortunately, well maintained and working parental controls to restrict the kid's computing is almost non-available for Ubuntu. Another major issue is that as soon as they are smart kids all measures we took become in vain. They will always find ways to overcome our restrictions, in case they are really smart without us even being able to notice.
Any blocking software or PAM-restrictions running on the kid's computer will be temporary only, and may sooner or later be overcome very easily. Therefore we decided to let the password-protected router do the job, where physical access can be controlled much easier.
So what we do here to somewhat limit gaming at the moment is a combination of all of the following:
sudo
group sooner or later. The plan is that they will ask us for that rather than making this in hiding.To ease fulfilling the contract on computer usage for both, the kids, and us we installed the following restrictions:
Blocking internet access will effectively disable gaming if that game needs internet access such as Steam, Minecraft, or other gamig servers. It will however be of no effect for games running off line.
Set a time- limit on a process or application
With a small background script, you can set a time- limit on a process or application.
As long as your user does not know the administrator's password, it is not surpassed too easily.
The solution below
Is such a small background script. It limits the usage per day to a defined number of minutes, to set in the head of the script. Once set up (which is not too difficult) it runs very easy, and no additional action is needed afterwards.
The script
How to use
limit
limit_use
(no extension) inside the folder and make it executableEdit in the head of the script the process name to limit, and the maximum number of allowed minutes. In the example:
Copy the folder to the directory
/opt
:Now edit
/etc/rc.local
to make the script run it asroot
on startup:Just before the line
another line:
That's it
When someone tries to kill the background script:
(action not allowed)
Explanation; how it works
/opt/limit/uselog
). If the dayly limit is reached, the script no longer allows the process to run, killing it if it exists.rc.local
only user(s) with sudo privileges can stop the script, even then only if the user knows the process name.Stop the script
In case you'd like to stop the script, use the command:
But again, you'd need the sudo password to do so.
EDIT
Although the script above should provide a reasonably secure way of limiting an application's usage, as mentioned by @Bytecommander, it can be surpassed, although not very easily. The combination with the measure below will make it very unlikely that this will happen, unless your son knows the setup, and is quite experienced with Linux/Ubuntu.
Additional measure
A bit further from a "simple solution", but still not too difficult to set up is the additional measure below. If our suspected delinquent would find out the script is called from
/etc/rc.local
, would manage to become root, and remove the line in/etc/rc.local
, or would be able to stop the script that way, we can confront him with the next problem: the screen blacks out after log in. Additionally, the solution checks if the background script is running after 5 minutes after restart, blacking out if not.The extra measure is a startup- check if the line
/opt/limit/limit_use &
is present in/etc/rc.local
, and a check after 5 minutes if the script still runs. Since the script runs from a (hidden from Startup Applications) launcher in/etc/xdg/autostart
it will be quite difficult to find out what is happening, unless you know how it is done. The combination of these two measures makes it unlikely your son will find out, and if he does, probably nothing will stop him.How to set up
Two simple steps are involved:
Copy the code below into an empty file, save it as
blackout.desktop
on your desktop:Copy the file to
/etc/xdg/autostart
:Copy the script below into an empty file, save it as
blackout.py
on your desktop, make it executable and copy it to/usr/local/bin
:The script
Explanation
Launchers in
/etc/xdg/autostart
will launch an application (in this case the extra security check- up) for all users. This could be overwritten locally, but you have to know the check up runs. By putting the lineNoDisplay=true
into our launcher, it will not appear locally inStartup Applications
, so without knowing it exists, it is unlikely to be discovered.Furthermore, your son has only 15 seconds to find out (then the screen is blacked out) so he would have a serious problem, unless he is a genious, has a lot of experience with Ubuntu and a creative mind.
This can be achieved by using shell scripts.
First script is to kill
Steam
as soon as it is run:Save it as
/path/to/anyname.sh
and add it to the list of start-up applications.What this script will do is that it will check any open process named
steam
every second and if it finds any then it will kill it.But, you need a solution where
steam
can be run at a specific time right so that your son can play games during that interval. To do that you have to write another script:Save it as
/path/to/anyname2.sh
and also add this to your list of start-up applications.This script will kill the first script at 10:00 hrs. So, when your son runs
Steam
at 10:00 hrs. He will be able to play it now.The third script is to re-initiate the first script at another point of time so that it kills
Steam
after a time interval and your son won't be able to play games throughSteam
anymore.Save it as
/path/to/anyname3.sh
and add it to your list of startup-applications.Make sure to keep those paths hidden, so that your son doesn't find out.
Why not use new User Account (via System Settings). This is the only one method on Linux for "permissions".
sudo
group). Then this account will not have root access, it will not be able to install or remove software, change system-wide settings.Few notes..
/home/son/.steam
and of course the binary file/usr/games/steam