Creating a User Database


htpasswd -c file userid


To create a user database (also known as a password file), you can use the htpasswd utility included with Apache. The syntax to create a new password file and add a user to it on Unix is shown in the example. On Windows, you will need to use

htpasswd.exe -cm file userid


If you want to add a new user to an existing password file, the syntax on Unix is simply

htpasswd file userid


and on Windows

htpasswd.exe -m file userid


You will be asked for a password and it will be added to the user database.

You should not keep the password file in any directory accessible from the Web. You should not use -c when adding users to an existing file, as this will destroy the previous contents.

As an example, the following line creates a password file named htusers and adds a user named admin:

htpasswd -c /usr/local/apache2/conf/htusers admin





Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net