Return to Snippet

Revision: 3877
at September 26, 2007 21:19 by jonhenshaw


Initial Code
Step 1 - Create .htaccess file in folder you want to protect, copy the code and paste the code below, and then set server path to the file

AuthUserFile /path/to/.htpasswd
AuthName "Restricted Area"
AuthType Basic
Require valid-user


Step 2 - Open Terminal, go to the directory you want to protect, and enter the following (changing the username to whatever you want). Enter the password upon prompting.

htpasswd -c .htpasswd username

Initial URL
http://ag.arizona.edu/ecat/web/password-protect.html

Initial Description
Good info here too: http://www.ilisys.com.au/support/linux-password-protect/

Initial Title
Password Protect Folder / Directory with htaccess and htpasswd on Apache and Linux / Unix

Initial Tags
unix, linux, htaccess, apache

Initial Language
Bash