Unix Review > Archives > 2004 > May 2004

May 2004

Apache Authentication

by Russell J.T. Dyer

Although most Web pages are designed for public use, there are situations when you need to protect certain Web pages and directories from the general public. For those situations, it's necessary to configure Apache to request authentication from the user or implement some other method to control user access. In this installment of my series on Apache, I will describe authentication and how to control user access.

There are only a few tasks that must be performed to restrict access to a Web directory. The first is to determine which directory and files are to be restricted and who will have access to them. For the users that you will permit access rights, you will need to set up a list of them along with their passwords. The second task will be to edit the Apache configuration file (httpd.conf) or a .htaccess file contained in the restricted directory. If you're not familiar with this configuration file, you may want to refer to a previous article that I wrote on Apache Basics.

Basic Password File

The most common way to manage users and their passwords is to use the htpasswd program that comes with Apache. With it, you can create a password file and add users and set their passwords. This file should be placed in a directory outside of the document root directory of your site (i.e., the argument of the DocumentRoot directive). Otherwise, an anonymous user might be able to download the user file and then decrypt the passwords at his leisure. So if your document root is /var/www/html, you might create a directory called /var/www/users in which to place your user authentication files.

Sys Admin Spotlight

CMP DevNet Spotlight

Career Center: Going It Alone
Ever dreamed of leaving that corporate development job for the challenges of independent software consulting? Here are 10 tips to make your solo career path a success.

In the News

CD-ROM

Sys Admin and The Perl Journal CD-ROM version 11.0

Version 11.0 delivers every issue of Sys Admin from 1992 through 2005 and every issue of The Perl Journal from 1996-2002 in one convenient CD-ROM!

Order now!




MarketPlace

"Six Sigma" Certification
Villanova Six Sigma Certification 100% Online Program - Free Info.

PMP Certification-Online
Nation's Leading Online PMP Course From Villanova-Find Out More Now.

Automate Software Builds with Visual Build Pro
Easily create an automated, repeatable process for building and deploying software.

WinDev 12 - Powerful IDE
Develop 10 times faster ! ALM, IDE, .Net, RAD, 5GL, Database, 5GL, 64-bit, etc. Free Express version

Wanna see your ad here?