Deny Internet in Ubuntu

posted in: Linux, Technicalities | 0

I have phases in my work cycle, where I want to limit internet access to myself. Thus, I created a »work-user« and in the user’s properties I unticked the boxes 

  • Connect to internet using a modem
  • Connect to wireless and ethernet networks
  • Use modems

I thought that should do the trick, yet it didn’t restrict internet access to this user. I tried various other things to deny access to network and web and finally found something useful at ubuntuusers.org (German):

create a file in /etc/init.d (filename doesn’t matter)

sudo touch /etc/init.d/iptab-filter.sh

Open the file you created:

sudo gedit /etc/init.d/iptab-filter.sh

and paste the following code:

#!/bin/bash iptables -A OUTPUT -m owner –uid-owner USERNAME -j DROP

Replace USERNAME with the desired user’s user name, save, close and run

ln -s /etc/init.d/iptab-filter.sh /etc/rc2.d/S99iptab-filter

Done.

Result:

The script that prevents user USERNAME to access the internet runs at start up, so user USERNAME is denied access to the tubez for good. 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.