ali aboos

Linux: .htaccess and .htpasswd files

by on Jan.24, 2009, under Linux

You can use .htaccess to protect a directory on your Apache web server. Users trying to access a protected directory will be asked to enter a user and password. .htaccess defines the protected directory, and .htpassword stores your password hashes.

.htaccess normally looks like this:

AuthName "Title"
AuthUserFile /path-to-your-htpasswd-file/.htpasswd
AuthType Basic
require valid-user

To create a .htpasswd file:
htpasswd -c /path.to.the.folder.you.want.to.protect/.htpasswd <username>

or

htpasswd -c <username>

and you will be prompted to enter a password for <username>

Of course, you can use a .htpasswd generator. Remember, Google is your friend 🙂

CC0 1.0 To the extent possible under law, the creator has waived all copyright and related or neighboring rights to this work.

:

Leave a Reply

Time limit is exhausted. Please reload CAPTCHA.

Search InsaneLabs.com

Can't find what you're looking for? Drop a comment on a post or email (ali aht insanelabs doht com)

Links

Links open in a new window