how to block a user from accessing internet in linux.

Is the following command correct.

iptables -A OUTPUT -p tcp --dport 80,443 -m owner --uid-owner $USERNAME -j DROP
link|improve this question

57% accept rate
4  
should be on superuser.. – opc Nov 28 '09 at 11:20
yes .. I have the super user permissions, I want restrict internet access to some users for sometime. – Santhosh S Nov 28 '09 at 13:10
superuser.com instead of stackoverflow.com – bmargulies Nov 28 '09 at 13:27
feedback

migrated from stackoverflow.com Nov 29 '09 at 23:17

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 1 down vote accepted

I think that blocking http and https ports is not enough, however a user can use proxies or socks to by pass this restriction or may be some kinds of VPN.

The right way is to block all access to your users and permit all ports you need users to access.

link|improve this answer
feedback

there are some many other back-door ports that can be used besides 80 & 443... you should be using the "on network" vs "off network" strategy: block access to the IPs not part of the home LAN instead. I am not sure how to express this using iptables... I would have to google-it and so can you :-)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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