Challenge - 5 Problems
Basic Authentication Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of this command to create a password file?
You run the command
htpasswd -c /etc/nginx/.htpasswd user1 and enter the password pass123. What will be the content format of the file /etc/nginx/.htpasswd?Nginx
htpasswd -c /etc/nginx/.htpasswd user1
Attempts:
2 left
💡 Hint
The password is not stored in plain text but hashed for security.
✗ Incorrect
The htpasswd command creates a file where the password is stored as a hash, not plain text. This is to keep passwords secure.
❓ Configuration
intermediate2:00remaining
Which nginx configuration snippet correctly enables basic authentication for /admin path?
You want to protect the /admin URL path with basic authentication using the password file at /etc/nginx/.htpasswd. Which configuration snippet will work?
Attempts:
2 left
💡 Hint
Check that auth_basic is enabled and the correct file path is used.
✗ Incorrect
Option C correctly enables basic authentication with a realm name and points to the correct password file. Option C disables auth_basic. Option C uses a wrong file path. Option C includes an unnecessary 'allow all;' directive.
❓ Troubleshoot
advanced2:00remaining
Why does nginx ignore basic authentication despite correct config?
You configured nginx with basic authentication for /secure path, but users can access it without a password prompt. What is the most likely cause?
Attempts:
2 left
💡 Hint
Check if another location block matches the request without authentication.
✗ Incorrect
If another location block matches the request and does not have auth_basic enabled, nginx will serve that block without authentication, ignoring the intended protection.
🔀 Workflow
advanced2:00remaining
What is the correct workflow to enable basic authentication on nginx?
Arrange the steps in the correct order to enable basic authentication on nginx for a website.
Attempts:
2 left
💡 Hint
Think about creating credentials before telling nginx to use them.
✗ Incorrect
You first create the password file, then configure nginx to use it, reload nginx to apply, and finally test the setup.
✅ Best Practice
expert2:00remaining
Which practice improves security when using basic authentication with nginx?
Basic authentication sends credentials encoded but not encrypted. Which practice best improves security when using it?
Attempts:
2 left
💡 Hint
Think about protecting data sent over the network.
✗ Incorrect
Basic authentication credentials are only base64 encoded, not encrypted. Using HTTPS encrypts the entire connection, protecting credentials from being intercepted.