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.

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:

http_proxy="http://myproxy.example.com:8888"
https_proxy="https://myproxy.example.com:8888"

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?

share|improve this question

migrated from serverfault.com Mar 6 '12 at 13:45

This question came from our site for professional system and network administrators.

add comment

2 Answers 2

up vote 2 down vote accepted

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 :)

share|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? –  Sandeep Datta Aug 7 '12 at 9:13
add comment

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.

share|improve this answer
add comment

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.