Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Is there a way to prevent a specific process from creating any TCP/UDP connection under Linux? Just like the firewall under Windows, I need to block a process's any network activity.

share|improve this question
If you are extremely paranoid you could move it into a vm, or container, I gather that you are looking for something more light weight though. – Zoredache Jan 7 '13 at 9:12

One possible way to do it is to run this process under specific user and DROP all traffic generated by this user id using a rule like:

iptables -A OUTPUT -m owner --uid-owner <user_id> -j DROP

For more info, see man iptables (section: owner).

share|improve this answer

The one which Khaled said, is one of very good way of doing this.

Also, if you are into Selinux, then SElinux will serve this purpose for you and can also provide some other additional security requirements which you might be looking for.

Would surely suggest to give it a try.

share|improve this answer

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.