Apache htpasswd Usage Creating and Adding Users Accounts

How to create/add user to apache password file. Steps

On Windows XP Pro Start / Run /cmd (brings up the dos prompt) cd (drive)\(Apache directory)\bin Then run one of the following commands

Create file with a user
This creates a file named filename.txt with a username of user and a password of pass.

htpasswd -cbm filename.txt user pass

Add user to an existing file
This adds the username user1 and password pass to filename.txt

htpasswd -bm filename.txt user1 pass

File Locations

#Where to find or create the needed files C:\(Apache directory)\htdocs\(protected directory) = ht.acl C:\(Apache directory)\bin = (nameofpasswordfile).txt C:\(Apache directory)\conf = httpd.conf

ht.acl

AuthName "popup message when asking for username and password" AuthType Basic AuthUserFile C:/(Apache directory)/bin/(nameofpasswordfile).txt Require valid-user

httpd.conf

#Where to put in the httpd.conf #I put the new entries under this entry <Directory "C:/(Apache directory)/htdocs">      #...some data </Directory> #Added for password files #Added ht.acl because windows does not like .htaccess AccessFileName ht.acl .htaccess #Added for password protected directory <Directory "C:\(Apache directory)\htdocs\(protected directory)">      AllowOverride All      Order deny,allow      Options None </Directory>



Post a comment for www.mgwalk.com
 
Send your comment to www.mgwalk.com
 
Name:
Email:
Web Site:
Rating:
star blank star blank star blank star blank star blank (move mouse over star to select rating)
Comment:
Anti-spam word: (Required) *