diff --git a/README.md b/README.md index 217fce0..b5de684 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really warrant a full blog post. These are mostly things I learn by pairing with smart people at [Hashrocket](http://hashrocket.com/). -_355 TILs and counting..._ +_356 TILs and counting..._ --- @@ -310,6 +310,7 @@ _355 TILs and counting..._ - [Clear The Screen](unix/clear-the-screen.md) - [Copying File Contents To System Paste Buffer](unix/copying-file-contents-to-system-paste-buffer.md) - [Create A File Descriptor with Process Substitution](unix/create-a-file-descriptor-with-process-substitution.md) +- [Curling With Basic Auth Credentials](unix/curling-with-basic-auth-credentials.md) - [Do Not Overwrite Existing Files](unix/do-not-overwrite-existing-files.md) - [File Type Info With File](unix/file-type-info-with-file.md) - [Find Newer Files](unix/find-newer-files.md) diff --git a/unix/curling-with-basic-auth-credentials.md b/unix/curling-with-basic-auth-credentials.md new file mode 100644 index 0000000..3dc1748 --- /dev/null +++ b/unix/curling-with-basic-auth-credentials.md @@ -0,0 +1,29 @@ +# Curling With Basic Auth Credentials + +I often use `curl` to take a quick look at the responses of particular +endpoints. If I try to `curl` a URL that is secured with HTTP Basic +Authentication, this is what the response looks like: + +```bash +$ curl staging.example.com +HTTP Basic: Access denied. +``` + +I can give the credentials to `curl` so that it can plug them in as it makes +the request using the `-u` (or `--user`) flag: + +```bash +$ curl -u username:password staging.example.com +... +``` + +If I don't want the password showing up in my command-line history, I can +just provide the username and `curl` will prompt me for my password: + +```bash +$ curl -u username staging.example.com +Enter host password for user 'username': +... +``` + +See `man curl` for more details.