Server Fault is a question and answer site for system and network administrators. 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 trying to download a file with cURL from a password protected directory on my site. It is not working. Instead of the downloading the requested file, it downloads a HTML file that says, "Authentication Required!" I'm not sure what the problem is.

I've tried both of these (with the same result). The username and password are correct (and if the link below is used in a web browser, the file downloads successfully).

1) The username and password are included as part of the URL.

curl --O /file.dmg;

2) The username and password are included as an option.

curl -u username:wordpass.1 --O /file.dmg;
share|improve this question
up vote 0 down vote accepted

The problem was that authentication was set to Digest for the realm. Changing it to Basic fixed the problem.

share|improve this answer
Note that --digest or --anyauth should have done the trick for you as well since curl doesn't bother to detect what kind of authentication the server wants unless you tell it to with --anyauth. – DerfK Dec 17 '12 at 2:28

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.