Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
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! –  Peregring-lk Apr 14 '13 at 12:58
add comment

2 Answers 2

up vote 3 down vote accepted

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
share|improve this answer
    
I haven't a local wgetrc file, and /etc/wgetrc is completely commented, except passive_ftp = on. –  Peregring-lk 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. –  Peregring-lk Apr 14 '13 at 17:28
add comment

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).

share|improve this answer
    
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? –  Peregring-lk 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. –  Peregring-lk 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
add comment

Your Answer

 
discard

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.