Password protect a directory

If you would like to password protect a directory, create a .htaccess file in a directory which you wish to protect and insert the following parameters:

AuthUserFile /home/username/.htpasswd
AuthGroupFile /dev/null
AuthName “Private Area”
AuthType Basic

require valid-user


replace the “username” with the actual username. Create a .htpasswd file and place the username/password in the following format:


You can place as many users you wish in the .htpasswd file


I am a g33k, Linux blogger, developer, student and Tech Writer for My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.