At work, I have a proxy set on many files/applications.

In /apt/apt/apt.conf I have Acquire::http::Proxy "http://myproxy.example.com:8888" set.

In /etc/wgetrc I have:

https_proxy = myproxy.example.com:8888
http_proxy = myproxy.example.com:8888
ftp_proxy = myproxy.example.com:8888
use_proxy = on

In /etc/environment I have:


And in my network and proxy settings I have HTTP, Secure HTTP, FTP proxies set up as well.

So as you can see, I have proxies set up just about everywhere!

When I'm at home though, this all becomes an annoyance, because I have the go into every file and comment out the proxy settings. Do you know of an app/script to quick disable the proxy settings in all of these files and then quickly re-enable all of them?

Furthermore, do I need to have all these proxy settings in all of these files, could I reduce them?


i'm in a similar situation here, which not only requires me to turn on and off proxy settings, but sometimes to use a different proxy in another location.

what i do is install squid on my machine (any other proxy capable of using parent proxies can do), and then, point all my applications to this local proxy on my own computer.

i keep a configuration file for squid that uses the internet directly, and a config that lets squid use a parent proxy for each proxy i am required to use.

seen the benefit yet? when i move to another location, i don't have to touch the proxy settings of any of my programs, i just change one file, the one belonging to squid, and reload squid. i name the config files easyily-identifiable names, and the switching goes something like this:

cd /etc/squid
sudo cp squid.conf.work1 squid.conf
sudo service squid reload

the config that lets squid use direct net is "squid.conf.direct" for me.

hope this helps :)

|improve this answer|||||
  • That's rather clever! – Flukey Mar 6 '12 at 16:10
  • @Waleed can you share your configuration files? I'd be grateful if you could provide at least one for the direct connection and another for connection via proxy? – Autodidact Aug 7 '12 at 9:13

If you are running in a graphical run level then using the default Ubuntu network manager should set the proxy settings for everything. At Uni I used to set the proxy in Gnome's network manager and the proxy settings would then be set for terminal sessions (as an example). There may even be the ability to set 'Locations' nowadays (but I don't use Ubuntu so I can say for certain).

Debian also has the ability to specify different locations (and therefore settings) using scripts under /etc/networking/. See here though the docs state that the old ifup and ifplugd scripts are deprecated. I assume the same would apply to Ubuntu.

I believe at the command line, just setting the http_proxy/https_proxy environment variables should be sufficient. wget will read proxy info from there, you don't need to set it in the wgetrc file.

|improve this answer|||||

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.