htpasswd
Sourced largely from http://www.he.net/faq/tutorials/htaccess/demo.html
The file .htaccess
This file should be in the directory which contains the documents to restrict access to. The contents of this file specify the name of the password file.
For example, this is what my .htaccess file looks like:
AuthUserFile /arpa/hm/m/msittig/.htpasswd
AuthName someuser
AuthType Basic
<Limit GET>
require valid-user
</Limit>
Note that .htaccess will not work if there are extra spaces after AuthUserFile.
The file .htpasswd
This file contains the passwords of the users.
To create the .htpasswd file log in to this server using SSH, change directory to the directory you want to restrict access to, and type:
htpasswd -c ~/.htpasswd someuser
for the first user (where someuser is the username). You will then be prompted twice for the user's password. The -c option causes the .htpasswd file to be created. For each additional user type:
htpasswd .htpasswd otheruser
The End