CISE Help & Resources
Htpasswd
To password protect any directory tree, place the htaccess and htpassword files in the root of the directory you want to protect, like
Directory : /cise/homes/user/public_html/misc/private URL : http://www.cise.ufl.edu/~user/misc/private
and configure the htaccess file like the example below. Use the htpasswd program:
/usr/local/bin/htpasswd FILE USER
to add users. Here, FILE is the full path to the htpasswd file and USER is the name of a user to add or modify.
Complete documentation is available here.
Example
To restrict access to everything in /cise/homes/foo/public_html/private, the user could create the following htaccess file in that directory:
AuthUserFile /cise/homes/foo/public_html/private/htpasswd AuthName Test AuthType Basic require user bar
Here, AuthName is the prompt users will see when they are asked to log in. Then run the command:
/usr/local/bin/htpasswd /cise/homes/foo/public_html/private/htpasswd bar
You will be prompted for a password, and an htpasswd file will be created which looks something something like this:
bar:O0aQuXby1CYQg
It contains a username and an encrypted password. Then, only someone who knows one of the username/password combinations will be able to view pages in this directory.