mkdir public_html/protected # create directory chmod go+x public_html/protected # ensure web can access itwhere "protected" is a directory name of your choice.
AuthUserFile /fac/u/username/public_html/protected/.htpasswd AuthGroupFile /dev/null AuthName "restricted documents" AuthType Basic <Limit GET> require valid-user </Limit>where "username" is your username. Then properly protect the .htaccess file:
chmod go+r public_html/protected/.htaccess
touch public_html/protected/.htpasswd chmod go+r public_html/protected/.htpasswd /usr/local/apache/bin/htpasswd public_html/protected/.htpasswd georgehtpasswd will prompt for the password for the user (in this case, george). [Note: htpasswd is currently available on the DCS faculty cluster only on athos and on the DCS research cluster only on research.]
http://www.cs.rutgers.edu/~username/protected/
Note: As with all files being accessed via the web, they (and the .ht* files) must be readable by the httpd process. In general, that means the files themselves should be world readable and directories on the path to them must have the world execute bit set so that the files/directories can be opened. This implies that all users on the machine on which the files reside can read the files without restriction. If this is undesirable, special arrangements can be made to prevent this.