Ubuntu

Disable internet access for particular user in Ubuntu

This is very useful if you want to block internet access to your kids or particular users

First you need to edit the network interfaces file using the following comamnd

sudo vi /etc/network/interfaces

or

sudo gedit /etc/network/interfaces

Now you need to add the simple iptables rule to the interfaces file when the internet connection starts up

Simply add this under auto wlan0 or auto eth0 in the interfaces file

pre-up iptables -A OUTPUT -p tcp -m owner –uid-owner username -j DROP

save and exit the file.

Now you need to type in the terminal with the following command

sudo iptables -A OUTPUT -p tcp -m owner –uid-owner username -j DROP

and switch users to the username you blocked and try to access the internet.

Advertisements

4 replies »

  1. very nice, i already tried it but i notice that i restart the machine the certain user has its internet connection again and i have to re run the command again on the terminal.

    Is their a way to make this permanently applied per specified user.

    Thanks in advance.

    Like

  2. I had it working very nicely – then it stopped and I’m in the same situation as Leo. Only change is LinkStation NAS box added to network.

    Like

  3. Yes also from my side on Ubuntu 9.10, I have applied the limitation line in the file /etc/network/interfaces but the user still have his connection.
    Any comment ?

    Thanks
    Rino.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s