![]() |
Netmar.com |
| Contact Netmar | |
| Order Webhosting | |
passwords.txt
located in user johndoe's home directory.
AuthUserFile /users/j/johndoe/passwords.txt AuthName John Doe's Members-Only Area AuthType Basic <Limit GET POST PUT> require valid-user </Limit> |
htpasswd [-c] passwordfile username
where passwordfile is the name of the password file, and username is the username you want to create or modify. The -c option would be used to tell htpasswd that the password file does not exist yet and should be created. Obviously, you only need to use it the very first time, because after that, the password file will exist.
Following our example, user johndoe would go to his home directory and create the password file there. In order to correspond to the .htaccess file, it should be named "passwords.txt". He would type as follows: (Note that what he would actually type is in boldface type. Everything else is output returned by the system. Also note that passwords do not appear on the screen when typed, which is why nothing appears next to the password prompts below.)
netmar> cd ~ netmar> htpasswd -c passwords.txt jane Adding password for jane. New password: Re-type new password: netmar> htpasswd passwords.txt joe Adding password for joe. New password: Re-type new password: netmar> htpasswd passwords.txt jim Adding password for jim. New password: Re-type new password:
If you must create the file on your local computer and upload it, make sure you upload it with your FTP client in ASCII mode.