Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 3 down vote accepted

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:

sudo apt-get install gufw

Once it finishes, just type gufw at the terminal prompt, and with the application opens, click on Edit, and then Add Rule.

enter image description here

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

enter image description here

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.

enter image description here

And you can see that it keeps saying connecting..

enter image description here

share|improve this answer
    
Thanks - unfortunately, ufw can only block some BitTorrent clients or Skype, not e.g. Dropbox. –  Florian Echtler Jun 11 '13 at 11:43
    
Look at the info I added regarding Dropbox. –  Mitch Jun 11 '13 at 12:13

This can be achieved if we restrict application from AUTOMATIC PULL configuration. Example for Update Manager

enter image description here

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

# Home Wifi
iface homewifi inet static
  # Set the DNS entry
  dns-domain something.net.com
  dns-search some.net yes.something.net www.somesite.com
  # Set the sysprefs.js entries for update.
  script /usr/sbin/which_edits_the_sysprefs.sh

We may add anything we want to have the same executed on a specific network.

share|improve this answer
    
Thanks, but I was hoping for a way to disable updates and similar stuff only when I'm on mobile broadband. I'm ok with automatic updates as long as I'm on my home wifi. –  Florian Echtler Jun 11 '13 at 11:44
    
Could you please have a look on the part for upgrades on preferred network. –  karan Jun 11 '13 at 12:55
    
Thanks, that's pretty close. Any way to do that for NetworkManager (whose networks are not defined in /etc/network/interfaces)? –  Florian Echtler Jun 11 '13 at 14:05
    
BTW, are you sure you can use "pref(...)" in /etc/network/interfaces? AFAICT it's not a Javascript file. –  Florian Echtler Jun 12 '13 at 14:00
    
Yes, pref wont right away work, we may initiate the script command for the same as edited on my response above. –  karan Jun 13 '13 at 6:29

To answer my edited question myself: NetworkManager indeed sends a DBus signal which looks as follows:

signal sender=:1.6 -> dest=(null destination) serial=2031 path=/org/freedesktop/NetworkManager; interface=org.freedesktop.NetworkManager; member=StateChanged
uint32 70

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.

share|improve this answer

Your Answer

 
discard

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.