How to Check That Username Password Is Correct Using Curl Command?

I want to be able to write a curl command where in i pass options like username password in the curl itself and it should connect to the server. Is there a way where we can find if the user is able to connect to that mentioned server? That means it should throw some error while I run the curl, if the credentials are incorrect. I was trying the below :-

curl --silent -k --digest -u "admin:admin" ""

But this return nothing.

1

1 Answer

According to man curl the reason you're getting no response is --silent, as expected:

Silent or quiet mode. Don't show progress meter  or  error  mes‐
          sages.   Makes  Curl mute. It will still output the data you ask
          for, potentially even to the terminal/stdout unless you redirect
          it.

If you don't want the progress meter, the likely reason you chose to add --silent, but you want to see the error messages then you must use -S additionally.

Your Answer

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

Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest