• 4th, Aug 2010

Apache Http Password in Directory

1) Create the password file .htpasswd
Go to the directory to protect and type in the shell

htpasswd -c -m .htpasswd webuser

-c means create file.
-m MD5 algorithm.

…if you want to get the generated MD5 password in the screen just type

htpasswd -n -bm  webuser 123456

2) Create a file .htaccess

AuthName "Restricted Area"
AuthType Basic
#This is the file you generated before (absolute server path)
AuthUserFile /var/www/html/.htpasswd
AuthGroupFile /dev/null
require valid-user

3) Test it

Tags: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *



HTML tags are not allowed.

© 2010 unexpected[it]. All Rights Reserved.