Ubuntu – Enable proxy settings at work, disable proxy settings at home

PROXY

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?

Best Answer

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