1

If I execute wget from my terminal to download something, it realices multiple attempts to download it, and eventually it downloads it (or not!). For example, with three attempts and 10 seconds of wait, I get the next output:

$ LANG=C wget -T 10 -t 3 -O contents.txt www.google.com
--2013-04-14 14:55:48--  http://www.google.com/
Connecting to 213.181.73.145:80... failed: Connection timed out.
Retrying.

--2013-04-14 14:55:59--  (try: 2)  http://www.google.com/
Connecting to 213.181.73.145:80... failed: Connection timed out.
Retrying.

--2013-04-14 14:56:11--  (try: 3)  http://www.google.com/
Connecting to 213.181.73.145:80... failed: Connection timed out.
Giving up.

But if I execute the same line with sudo, the download works fine and immediately. Why is the reason?

Moreover, if I put a wget line inside a script, and this script is called from cron, also wget works fine.

EDITED It's an issue with a proxy. With: wget --no-proxy works also fine. How can I check which proxy are been using by the system? And why sudo ignore this proxy?

2
  • What happens if it does not download. Does it start at all? Do you get an error message? ....
    – Hennes
    Apr 14 '13 at 12:50
  • Post edited with more information! Apr 14 '13 at 12:58
3

Probable causes include:

  • a custom ~/.wgetrc in your $USER home directory.
    Check /etc/wgetrc and man wget(1)
  • http_proxy is set in any of your profile startup scripts
3
  • I haven't a local wgetrc file, and /etc/wgetrc is completely commented, except passive_ftp = on. Apr 14 '13 at 13:01
  • The power of simple hypotheses :-). +1
    – LSerni
    Apr 14 '13 at 13:22
  • You're completely right: env | grep "proxy" prints http://213.181.73.145:80 for both http and https. But I'm trying to discover where this proxy is setted, but I don't find anything. Apr 14 '13 at 17:28
2

213.181.73.145 is so not Google. It is a Spain address of the TELEJUMILLA PA block, which is not (as far as I know; I may be mistaken) affiliated with Google.

Try checking what IP you get when root.

(WAG: you're inside TeleJumilla, and ordinary users ought to get redirected to a proxy, which is not working, or is firewalled from the inside too).

4
  • You're right. IP's are differents. How and/or where can I check or see which DNS server are wget asking, or how can I force wget to use an specific DNS server? Apr 14 '13 at 13:09
  • You can try asking a nonexistent host and checking both output and error message. This ought to work in most distros: host -vvv domainthatdoesnotexist.org. See also updated answer: you can check the iptables configuration.
    – LSerni
    Apr 14 '13 at 13:16
  • I have edited the post. It's a problem with proxies. Apr 14 '13 at 13:17
  • Ah, I'm a fool. That was not wget trying to connect to Google, it's simply wget trying to connect with the proxy. I have a different version of wget and it fooled me. The correct answer was @dawud's (option 2), and you ought to check your user's login scripts.
    – LSerni
    Apr 14 '13 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.