Is there a way to find which processes in my system are getting connected to net automatically. Is there a way to select and block net access of some processes permanently? I use mint 11. I use a USB datacard.


You can do:

sudo netstat -apn | less

This will give you the list of all current network connections and processes associated with them.

You can see which ones are going outside your network you might be able to awk and grep your way to make the list more concise.

The way to block the process from accessing the net would be to install a Proxy like SOCKS 5 and force the processes to log in. The other way is to have a firewall and systematically block the target sites. Beyond that I don't see a way of selectively blocking the access.

  • sorry cant get what is awk and grep. Can you tell how to block a process from connecting to net automatically – bubble Feb 1 '12 at 14:31
  • @bubble - That is a completely off-topic for this question, so ask it in a completely different question. Also see mywiki.wooledge.org/XyProblem, which it appears you are committing. – Chris Down Feb 1 '12 at 14:36
  • @Chris. Thanks for the link. I think I must know the processes before blocking them. Isn't it quite logical. Sorry if its completely different. Please tell me how to do it – bubble Feb 1 '12 at 14:44
  • @bubble - If you create an appropriate question, no doubt some would oblige. – Chris Down Feb 1 '12 at 14:51
  • @Chris Is it okay now ? – bubble Feb 1 '12 at 14:57

You can't control which applications have access to a network connection. That would be pointless anyway, as a program could invoke some other program to connect to the internet on its behalf (e.g. invoke a web browser or a web crawler if it wants to make HTTP(S) requests, or invoke netcat, etc.).

If you want to watch what processes make network connections, see Logging outgoing connections as they happen.

If you want to prevent a process from making (some) network connections, run it as a dedicated user and add firewall rules containing that user; see iptables/pf rule to only allow XY application/user?, How to restrict internet access for a particular user on the lan using iptables in Linux, Can I limit a user (and their apps) to one network interface?.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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