FreeKB - Curl -u --user (authentication)
Curl - -u --user (authentication)

In this example, the foo.html page is being requested from the www.example.com web server.

curl https://www.example.com/foo.html

 

Let's say access to this page require basic authentication (username/password). The -u or --user option can be used to include a username and password in the request.

curl --user john.doe:itsasecret https://www.example.com/foo.html

 


Special Characters

Be aware that if the username or password contains special characters, such as an exclamation point . . . 

curl --user john.doe:itsa!secret https://www.example.com/foo.html

 

Something like this will be returned.

-bash: !s: event not found

 

Special characters will need to be escaped, like like.

curl --user john.doe:itsa\!secret https://www.example.com/foo.html

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter c7bd1 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |