Empulse Group a collection of notes from a sys admin, musician, and father

3Jan/080

Quick Directory Password Protection using Apache

Here are some quick steps to password protect a directory using the Apache web server.

# cd /path/to/www
# vi .htaccess

press 'i' for edit mode
press 'esc' to exit edit mode
':wq' to save

the file should be as follows:

AuthType Basic
AuthUserFile /path/to/www/protect/.htpasswd
AuthName "Restricted Area"
require valid-user

then add the user:

# htpasswd -c /path/to/www/.htpasswd username

then ender a desired password.

 

UPDATE: You may need to also add the following to the domain Virtual Host block to allow the .htaccess file to be used.

<Directory "/path/to/www/protect">
AllowOverride All
</Directory

Filed under: Linux Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.