0

I created a user account on Ubuntu for my 8 year-old son, and I would like to let him use it freely, except for Internet.

How to make that:

  1. once logged on his account, Internet is disabled by default
  2. I can sometimes manually enable Internet on his account with a simple command or GUI button, with a password that I keep secret
  3. then, when his session is logged off or computer rebooted, Internet is disabled by default automatically again

I have found solutions with iptables here and in some other places, but:

  • I think that this does not allow 2. and 3. easily

  • also I was looking for something available from the GUI.

Is there anything like this built-in?

  • 2
    In my family, we found it more useful to disable the internet for everybody (including mom and dad) until certain critera were met. The kids found that solution to seem much more fair, and it generated much less resentment, anger, and frustration. – user535733 Nov 23 '19 at 15:41
  • @user535733 Good idea, and it would also help us to be less computer-dependent, we'll maybe try this! – Basj Nov 23 '19 at 15:45
0

Here is a method:

1) Following How to disable internet for a user on a system, first do this:

sudo iptables -A OUTPUT -m owner --uid-owner {USERNAME} -j REJECT

2) Then make it permanent after each reboot, following this method:

apt-get install iptables-persistent
iptables-save > /etc/iptables/rules.v4

(The last line required this for me: sudo su -)

3) Then if you want to grant access to internet from your child's account, open a terminal and do:

su dad  # enter password
sudo iptables -D OUTPUT -m owner --uid-owner {USERNAME} -j REJECT  # re-enter password 

After a reboot, it will be blocked by default again.

Another solution for 3) if root has a password: create a file unblockinternet.sh containing:

su -c "iptables -D OUTPUT -m owner --uid-owner {USERNAME} -j REJECT"

and then launch this script to unblock internet.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.