If you want to download a file directly on your server using wget, but it requires HTTP authentication, then you'll get this error:

$ wget http://to-some-domain.tld/path/to/file
--2011-06-09 18:02:36--  https://to-some-domain.tld/path/to/file
Resolving to-some-domain.tld... 10.20.30.40
Connecting to to-some-domain.tld|10.20.30.40|:80... connected.
HTTP request sent, awaiting response... 401 Authorization Required
Authorisation failed.

And here's how to solve it:

$ wget --user=username --ask-password http://to-some-domain.tld/path/to/file

Alternatively, using curl:

$ curl -u username http://to-some-domain.tld/path/to/file

Share on: TwitterHacker NewsFacebookLinkedInRedditEmail


Published

Last Updated

Category

Security

Connect with me on...