I'd search for a way to run an application prevent it from accessing internet, possibly without install a specific program to do this. Most of the answers I've found refers to THIS post, so I tried this solution. In short words I had create a no-internet group (with a related ni command) and I launch the application using this group. But that does not work completely, probably because the post is from 2009, and something in iptables is changed (I'm using Ubuntu 14.04). For example if I run ni "ping google.com"
the output is ping: sendmsg: Operation not permitted
, so the solution works great. But with the other programs, like Firefox or wget (e.g. ni firefox
), the internet connection still works. How can I solve?
Ubuntu – How to block internet access for an application
firewallinternet
Best Answer
You can use
apparmor
to deny network traffic for some application. First you must installapparmor
andapparmor-utils
..After that you can generate profile to you application ...
Next step is to change
Networking
part in profile to:Next, check config with apparmor_parser and reload config
Change mode from
complain
toenforce
aka turn onapparmor
for this app.More manual you can find here and here and here