Site's Administration : Password protecting directories
Contents ]
Dr Benton

Creating the Password File

The passwords are stored in the file called .htpasswd. This is a plain text file that contains the names of all the authorised users and their passwords. Each entry consists of a user id followed by a colon and a password.

For instance, the following file grants access to the usernames robert and herve with their respective passwords bonjour and aurevoir:

robert:bonjour
herve:aurevoir

The simplest solution is to store the .htpasswd file in the directory to be protected. However, this poses the problem that anyone accessing this directory would also have access to all passwords. This is why all passwords have to be encrypted first.

There are several ways of encrypting passwords:

  • Windows users: Use the htpw.exe tool.

  • This program generates the file containing the encrypted passwords. The next page of this workshop shows you how to use it.

  • Here you will find an automatic encryption module.