Difference between revisions of "Apache basic authentication"

From Noah.org
Jump to navigationJump to search
(New page: Category:Engineering Add a user to an <em>existing</em> .htpasswd file: <pre> htpasswd /var/www/htdocs/restricted_dir/.htpasswd staff </pre> Create a <em>new</em> .htpasswd file (note...)
 
 
Line 1: Line 1:
 
[[Category:Engineering]]
 
[[Category:Engineering]]
 +
First you have to decide if you are creating a new password file or adding a user to an existing password file. In these examples the user is name "staff".
 +
 
Add a user to an <em>existing</em> .htpasswd file:
 
Add a user to an <em>existing</em> .htpasswd file:
 
<pre>
 
<pre>

Latest revision as of 18:57, 5 February 2008

First you have to decide if you are creating a new password file or adding a user to an existing password file. In these examples the user is name "staff".

Add a user to an existing .htpasswd file:

htpasswd /var/www/htdocs/restricted_dir/.htpasswd staff

Create a new .htpasswd file (note the -c option):

htpasswd -c /var/www/htdocs/restricted_dir/.htpasswd staff

Create a .htaccess file:

AuthType Basic
AuthName "Restricted Area"
AuthUserFile /var/www/htdocs/restricted_dir/.htpasswd
Require valid-user