Password Protect folders in Apache with htpasswd

Want a completely insecure password protected folder using htpasswd?  Great!
A pointless exercise unless it’s in a setup at your work and you have no say in the matter, htpasswd’s are sent in unencrypted plain text, so anyone hanging around packet sniffing will pick up the password easily enough! Anyway, thats besides the point, how is it done?

First up we put this in the .htaccess for the directory we wish to protect (ha):

<Directory "/home/user/username/www/folder/to/protect">
AuthType Basic
AuthName "My Private Directory"
AuthUserFile "/path/to/htpasswd"
Require valid-user
</Directory>

Then we generate the htpasswd file like this:

 htpasswd -c /path/to/htpasswd username

Hooray! The illusion of ‘security’! At least it keeps non geeks out 😉

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s