Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Ubuntu 13.10 with proxy servers with user id and password. I am unable to run wget command.


Resolving ( failed: Name or service not known.
wget: unable to resolve host address ‘’

What can be done to resolve this?

share|improve this question
you have eget package installed ? # sudo apt-get install wget -y If you have already have a check using # dpkg -l | grep wget – Lonston Feb 24 '14 at 10:33
@Babinlonston - if wget won't work, there not much chance that apt-get will work (wget should work through proxies, apt-get just stops) – Wilf Feb 24 '14 at 11:50
yes below my solution is there – Lonston Feb 24 '14 at 12:34

Edit your Resolv conf using

# sudo vim /etc/resolv.conf

Then Enter the below


Replace with your Router IP

Edit this file too if not your DNS will override it

# sudo vim /etc/resolvconf/resolv.conf.d/base

Then Enter the below


Then Restart your Server Using

# sudo /etc/init.d/networking restart
share|improve this answer

There are two ways of running wget behind a proxy. Either set the appropriate environment variables and wget will act according to them or configure the wget configuration file - wgetrc.

Set the environment variable

Before setting the environment variables, lets first see if there are any preset proxy variables present. We can get that information using the following command.

$ env | grep proxy


If no proxy environment variable is set, it will go for direct connections. Lets take an example of my college. We use a HTTP proxy server. Running wget without setting the http_proxy environment variable just fails. So, lets set this env. variable first

$ export http_proxy=""

Now, run Wget and it should work like a charm. If your proxy also requires authentication i.e username & password then use this format

$ export http_proxy=""

Similarly, for other type of proxies - ftp_proxy, https_proxy etc. All we need to do is set the appropriate environment variable.

Please note that, the above commands will be in effect only till the user session expires, i.e. by running the above commands we are just setting the proxy env. for a session, not permanently. And usually we wouldn't want to run the command everytime we login. So, to make it permanent, we can either set the value in wget's configuration - wgetrc file or set the environment in ~/.bashrc file.

$ echo "export http_proxy=" | tee -a ~/.bashrc

It should be noted that, this way we might be affecting the user's proxy settings. A better way is to set the settings permanently in wget's configuration file, this way no other app. is affected.

Configuring the wgetrc file

Like most of the applications wget has a configuration file too - wgetrc:

  • /etc/wgetrc,
  • ~/.wgetrc.

The former is for global changes and the latter one is for local settings(user specific). We will go into the details later, lets just see how to apply the proxy settings. Its similar to setting the proxy environment variable, just exclude the export command. Open the file ~/.wgetrc file. If one doesn't exist, then create it.

vim ~/.wgetrc

Now, add the following statement in the file


How to disable/turn-off the proxy settings

Once you have configured the proxy settings in the wgetrc file, everytime you run wget, it will automatically connect to the proxy server. Sometimes for local/LAN based downloads, you may not need the proxy server. In such cases we can turn off the proxy settings using --no-proxy argument in the command

wget --no-proxy

If the proxy requries authentication - Username & Password

We already know the format for setting the environment variable with username and password. Wget provides you two methods to mention the username and password for proxy server.

  • Mention it in the command in the form of arguments.
  • Set the values in the configuration file, /etc/wgetrc or ~/.wgetrc

If the authentication you are using is static, then its better t set it in the configuration file. If its just one time thing or if you want to overwrite the settings in configuration file then you can use the --proxy-user & --proxy-password options.

wget --proxy-user=username --proxy-password=password

For permanent changes, its always advised to change the configuration file.

Once again, for global changes modify the /etc/wgetrc file otherwise go for ~/.wgetrc file. Open any of the file and append/add the following lines in it.



share|improve this answer

Your Answer


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.