Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know about changing owners/permissions on particular programs/files, but how can I control which users have access to the NIC or the power to create network sockets?

share|improve this question
up vote 5 down vote accepted

As described here, you can block all Internet access for certain users using this iptables command:

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

If you want this command to run automatically when the system starts up, you should add it to the end of your /etc/rc.local file.

While this won't make it impossible for those users to create sockets, it will block all outgoing traffic (like a firewall).

share|improve this answer
how would you then reverse this command? – par Aug 26 '15 at 16:29
@user2662639 Simply reboot. Unless you've added the line to /etc/rc.local, it's not persistent, and if you have, then you can just remove that line. – Frxstrem Aug 26 '15 at 16:36
@user2662639 (I think it's possible without rebooting but it's been three years since I wrote this answer and so I really can't remember anymore.) – Frxstrem Aug 26 '15 at 16:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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