Sunday, December 31, 2006

httpd.conf Basic Authentication.

Add these lines to a given directory section or .htaccess file:
AuthType Basic
AuthName "By Invitation Only"
AuthUserFile /etc/httpd/passwords
Require user admin1 admin2

Execute these commands to create / add users:
htpasswd -c /etc/httpd/passwords admin1 #create
htpasswd /etc/httpd/passwords rbowen admin2 #add

Or Create to stdout:
htpasswd -nbs user pass

To use a .htaccess file, the following is needed in a directory section:
AccessFileName .htaccess # ID .htaccess as override file (default)
AllowOverride AuthConfig # allows .htaccess to override authorization

No comments: