Basic HTTP Authentication with Apache 2
Jul 16, 2009
Apache's HTTP Authentication is a fast and easy way to lock down a directory so that it prompts users with a password dialog box to view the files.
This guide assumes that you have Apache2 already up and running.
- <Directory "/path/to/web/dir">
- AllowOverride AuthConfig
- Order deny,allow
- Deny from all
- #Allow from 192.168
- Allow from all
- AuthName "teh login"
- AuthType Basic
- AuthUserFile /usr/local/apache22/.htpasswd-name
- Require valid-user
- </Directory>
- # htpasswd -c /usr/local/etc/apache22/.htpasswd-name username-to-use
- New password:
- Re-type new password:
- Adding password for username-that-you-used
Now restart Apache so the changes will take effect and visit the URL you added the authentication for and you should be prompted with a password prompt. Enter the login information setup with the htpasswd command from earlier.
- apachectl graceful
Post a New Comment
- Tags
- AI (1)
- ALIX (1)
- digitalfoo.net (2)
- embedded (6)
- FreeBSD (30)
- Java (1)
- Linux (26)
- misc (7)
- my projects (1)
- MySQL (2)
- NanoBSD (3)
- opensource (7)
- perl (1)
- PHP (3)
- programming (11)
- Python (1)
- security (4)
- Archives
- 2011
- February (1)
- March (1)
- June (1)
- July (1)
- August (1)
- 2010
- June (5)
- July (2)
- December (4)
- April (6)
- March (2)
- May (1)
- August (2)
- October (1)
- November (1)
- 2009
- August (7)
- July (8)
- April (4)
- May (4)
- December (2)
- June (1)
- September (1)
- November (4)
- October (1)
- Web Tools
- Index
- dig-shovel Live
- SQL Injection Encoder
- Links
-

