Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : Security : Education - Tutorials
Securing your Web server
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
3. User authentication
  


Configuring httpd.conf for basic authentication page 4 of 12


The code sample below shows a directory block for authentication within the VirtualHost block. With this configuration, anytime a user tries to access the /home/httpd/htdocs/test directory, they'll be prompted for a username and password, which will then be verified against the password file (/home/httpd/users/basic) created in the previous panel.


User nobody
Group nobody
ServerName www.syroidmanor.com
ServerAdmin webmaster@syroidmanor.com
DocumentRoot /home/httpd/htdocs
ErrorLog /home/httpd/htdocs/logs/error_log
CustomLog /home/httpd/htdocs/logs/access_log custom

<VirtualHost 142.165.206.61>
ServerAdmin webmaster@syroidmanor.com
ServerName ols.syroidmanor.com
DocumentRoot /home/httpd/htdocs/ols
ErrorLog /home/httpd/htdocs/ols/logs/error_log
CustomLog /home/httpd/htdocs/ols/logs/access_log custom

<Directory /home/httpd/htdocs/test>
AuthType Basic
AuthName darksecrets
AuthUserFile /home/httpd/useraccess/basic
require valid-user
</Directory>

</VirtualHost>

The directives responsible for the authentication process are AuthType, AuthName, and the location of the user password file. Users requiring access to this directory need to supply a username, a password, and depending on the browser, the AuthName or realm. Most browsers keep a local record of the realm after the first access.


Main menuSection menuFeedbackPreviousNext
Privacy Legal Contact