First off, I am not a Linux guy, but I have to pretend to be one sometimes as a web developer.

So, we have a Red Hat server and I'm using wget in crontab to run some PHP scripts.

We've been doing this for some time now and it's been working fine.

I tried to add another script using wget to run a PHP script behind HTTP authentication. However, despite the fact that the URL works fine and the username and password are correct, we are getting Connection Timed Out errors each time.

What might cause wget to work for unauthenticated URLs, but not authenticated ones?

I've tried --user=/--password=, --http-user=/--http-password and Username:Password@ in the URL and all three fail the same way.

Here's the command in question:

[blahblah user]# wget -t 5 -O /dev/null 'http://Username:Password1!@test.example.com/sub/dir/file-name.php'
--2010-07-07 10:11:55--  http://Username:*password*@test.example.com/sub/dir/file-name.php
Resolving test.example.com...
Connecting to test.example.com||:80... failed: Connection timed out.

[Repeat ad nauseum]

Any thoughts? Again, wget works, the file with authentication works, but wget calling the file with authentication does not work.

UPDATE: Actually, I get the same timeout if I access the authenticated URL without authentication. Could that mean that Apache is rejecting wget requests for authentication outright? (I'm really treading into speculation territory here. I know almost nothing about Apache configuration.)


You say you tried --user= and --http-user=, did your tests include --password= and --http-password-? (Forgive me if that was implicit in your question, but this would make a difference if not)

What about trying --ask-password?

  • I apologize, I was implying --password= and --http-password=. I've updated the original question. --ask-password doesn't appear to be an option for me according to wget --help. – RadicalBender Jul 7 '10 at 16:41

Aha! The problem turned out to be with the firewall in front of the server. Our hosting company says DNS doctoring should solve it.

Thanks for everyone's help.

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.