wget using authentication proxy on Linux

Date: January 31st, 2010
Author: Stefan Batanov

In this tutorial we will demonstrate something that most of you may need to use just for a few times in their Linux experience but will be very happy that such functionality existed at first place. Commong Linux users, including me, are not so used to get things through a proxy. Maybe used one some time ago but I have totally forgotten that such things as proxies even existed. Anyway in case one day it happens that you find yourself in a corporate network and need to download someting from the command line you will find yourself into some trouble. Not that you cannot download it quickly using a browser but for example in my case it was a script that I had to make work. For such cases after you finish reading this tutorial you will know how to configure wget for using proxy with basic authentication.

There are two ways for wget to pick up the proxy server hostname. One way is from the environment variables and another way is via the wget configuration file.The main and only configuration file of wget is located in etc directory

  1. /etc/wgetrc

If you want to make this proxy thing permanent for the system and all services that use wget just put his line in wgetrc.

  1. http_proxy=
  2. proxy_user=user
  3. proxy_password=password

To be honest for the last two lines(proxy_user and proxy_password) I”m not completerly sure if they are supported in the config file. Unfortunately cannot really try them right now.

You can simply try to download and see if wget works for you.

If it doesn”t or if you just want to just download this one thing I recommend to not touch configuration files but run these two command which will make it all work for you.

  1. export http_proxy=
  2. wget proxyuser=user proxypassword=password http://www.mydomain.come/pub/file.zip

No restarts are needed next time you run wget command it will take the proxy settings form wgetrc config file automatically.

To learn how to setup apt-get command to use the proxy please check this tutorial.

VN:F [1.9.18_1163]
Rating: 2.5/10 (14 votes cast)
wget using authentication proxy on Linux, 2.5 out of 10 based on 14 ratings

One Response to “wget using authentication proxy on Linux”

Leave a Reply