Take the 2-minute tour ×

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
add comment

2 Answers

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
add comment

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
add comment

Your Answer


