
Password Management Installation Guide April 2002 11
2
Apache Basic Authentication
Basic Authentication is a way to password-protect your web content. Access is granted only
when a valid username and password is presented to your webserver.
Apache provides a simple way to use Basic Authentication. By creating an .htaccess file
you can protect an entire directory of content. The .htaccess file tells your web server
where to find a list of authorized usernames and passwords: a file called .htpasswd.
Setting Up Basic Authentication with Apache
If you need to set up Basic Authentication, follow these steps:
1. Identify the directory you want to password protect.
2. Create an .htaccess file. To create a password protected or “members only” section of
your website you need to create a .htaccess file. Change directories to the directory you
want to protect, for example:
cd /var/www/html/members
Create a new text file using any text editor; for example:
pico .htaccess
3. Add the following lines to the top of the file.
AuthName "Your Website Name"
AuthType Basic
AuthUserFile /var/www/files/.htpasswd
AuthGroupFile /dev/null
require valid-user
4. Change "Your Website Name" to the name of your website. You'll also want to change the
path specified by the line AuthUserFile to any location that is not in your document root
(the directory where HTML pages reside).
5. Create the .htpasswd file. The AuthUserFile specifies the file that maintains valid
username and password combinations to the protected area of your website. Create this file
using the following command (substitute /var/www/files/.
htpasswd with your own
path)
touch /var/www/files/.htpasswd
Kommentare zu diesen Handbüchern