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

Creating the Encrypted Password File with HTPW.EXE

To use the htpw.exe program, you must have some basic knowledge of DOS language (in fact, the cd command - change directory - should suffice):

  1. Open a MS-DOS session (Start > Programs > MS-DOS Prompt).

  2. Open the directory where this program is located.

  3. Then enter the following command:

  4. htpw -c passwd.txt userid1

    where passwd.txt is the name of the text file to be created and userid1 the username you wish to add.

    You will then be asked twice to enter the corresponding password (8 characters maximum)

  5. To add another username, type in the following command:

  6. htpw passwd.txt userid2

    The username userid2 must then be added to the passwd.txt file previously created. Note that if userid2 already exists in the passwd.txt file, the program will replace the existing password for this user with the new one that you will indicate.



    Figure 2: The password entered is not displayed in the DOS window.

    The passwd.txt file shown below was generated by htpw.exe and with the bonjour and aurevoir passwords for the users robert and herve.



    Figure 3: The passwd.txt text generated by the htpw.exe tool.

  7. As for .htaccess, you will have to rename your passwd.txt password file .htpasswd (using your FTP client).

  8. Now you just have to store the file in the protected directory alongside the .htpasswd file.

You can password protect different directories by storing the corresponding .htaccess and .htpasswd files under the root of each directory to be protected.