As soon as I go online via my portable 3G hotspot, all running programs happily start pulling updates (e.g. Gwibber, Thunderbird, Update Manager...) and eat into my traffic quota. Is there a way to activate a network connection, but only tell specific programs about it (e.g. Firefox, if I just want to quickly look something up)? Note that I'm not looking for bandwidth limiting, I just want to prevent the automatic "ooh, I'm online, let's get some data" behavior.
EDIT: I have already received two useful answers, however, I'd still like to add some clarification: what does NetworkManager do to tell running programs they're now online? I assume it's some sort of DBus message. Can I prevent that from being sent?
One of the ways that I would do that is using a Firewall. Ubuntu comes with it own Firewall UFW. You might want to install the GUI version, just to make it easier. To install it, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
Once it finishes, just type gufw at the terminal prompt, and with the application opens, click on Edit, and then Add Rule.
When that window opens, choose Deny --> Out --> Application -->, and then choose the application that you want. For command line control over the Firewall, see UFW
If you want to block e.g. DropBox, you can block the entire Dropbox network IP allocation listed in ARIN, as seen in the image below.
And you can see that it keeps saying connecting..
This can be achieved if we restrict application from AUTOMATIC PULL configuration. Example for Update Manager
Similarly you may configure for other applications like:
Disabling Automatic Update in Firefox
Type about:config in the address bar and press Enter.
You should get a page trying to scare you off with a message starting with “This might void you warranty!”, just click “I’ll be careful I promise!“.
Then in the Filter filed type app.update.enabled. It should be set to true, double-click on the line to set it to false.
Disabling Automatic update for Thunderbird
On the top menu, click on Tools->Options to enter the Options window, then click on Advanced and selct the General tab. Click on the Config Editor
You should get a page trying to scare you off with a message starting with “This might void you warranty!”, just click “I’ll be careful I promise!“.
Then in the Filter filed type app.update.enabled. It should be set to true, double-click on the line to set it to false.
Upgrades on preferred network
Referring to the man-pages of Network Switcher
You may have certain commands configured when you are on the 3Ghotspot/Homewifi. For an instance for thunderbird upgrades you may change the prefs.js(specific to user profile) or syspref.js(globally) to enable the update option.
So your would look like /etc/network/interfaces
We may add anything we want to have the same executed on a specific network.
To answer my edited question myself: NetworkManager indeed sends a DBus signal which looks as follows:
NM-aware programs listen to this message and react to it by starting to use the network. No way to prevent this without hacking on NM directly AFAICT.