| passwords | name of the directory in which the password file is located (better to choose a more obscure name) |
| passfile | name of the password file -- typically .htpasswd |
| username | name of the user |
| password | password for given user |
| page | name of the directory in which the protected web page is located |
| create password directory mkdir passwords | should be "outside" the normal web directory structure
|
||||||
| set permissions chmod a+rx passwords | |||||||
| change to password directory cd passwords | |||||||
| execute htpasswd program htpasswd -c passfile username |
program will prompt for password typically use .htpasswd for password file name to add user to existing list, execute htpasswd without the -c to delete user from existing list, edit passfile and delete line to change a password, delete the user, then add it back with the new password |
||||||
| set permissions chmod a+r passfile | |||||||
| change to page directory cd ../www/page | |||||||
| create new file with name .htaccess | enter the following information:
AuthName "<descriptive name for site>" AuthType Basic <LIMIT GET POST> require valid-user </LIMIT> | ||||||
| set permissions chmod a+r .htaccess | |||||||
| create a link to a web page in the page directory attempt to access the protected page using a browser |
the browser should prompt you for a username and password after entering the user name and password, the page should load normally you should be able to access the page (and all pages in any subdirectories) without re-entering the password until you restart the browser |
||||||