Configuring wget to use a proxy server


Periodically I need to download files on servers that aren’t directly connected to the Internet. If the server has wget installed I will usually execute it passing it the URL of the resource I want to retrieve:

$ wget prefetch.net/iso.dvd

If the system resides behind a proxy server the http_proxy variable needs to be set to the server name and port of the proxy:

$ export http_proxy=proxy.prefetch.net:3128

If your proxy requires a username and password you can pass those on the command line:

$ wget --proxy-user=foo --proxy-password=bar prefetch.net

Or you can set the proxy-user and proxy-password variables in your ~/.wgetrc file.

This article was posted by Matty on 2011-11-09 08:22:00 -0400 -0400