Tutorial: Command Line Proxy

James Bunton on Apr 14th 2008

Want to have your command line applications use the correct proxy to connect to the internet? Instructions here are applicable to Linux, OSX and other Unix systems.

Unix Environment

To use the School of IT proxies you want to set the following environment variables:
export http_proxy="http://www-cache.it.usyd.edu.au:8000"
export no_proxy="127.0.0.1, localhost, .usyd.edu.au"

sudo environment vars

sudo clears all environment variables before executing the command for security. This means if you run something like
$ sudo aptitude update
it won’t work because http_proxy gets cleared. You can fix this by doing the following. Be careful!
$ sudo visudo
Add this line:

Defaults env_keep="http_proxy https_proxy ftp_proxy no_proxy"

Mac OS X Location Settings

If you use Mac OS X and change locations frequently it’d be nice if your command line utilities picked up the proxy settings from System Preferences.

Have a look at http://delx.net.au/projects/proxyconf

Filed in Tutorials | No responses yet

Trackback URI Comments RSS

Leave a Reply