Change Font Size: A A A

This site will look much better in a browser that supports web standards, but it is accessible to any browser or Internet device.


Protecting files on Unix






Password protection

To password protect a directory (e.g. a resumé directory) on your deepblue account, first create the directory as a subdirectory of your public_html directory.

You will need to create two files in that directory to protect it.  An .htaccess file and a .htpasswd file. These files will serve to protect that directory only. No other directories (above or below) will be affected.

Assuming student c002933 wanted to protect a directory called resume, the first thing s/he would need to do is create a file called .htaccess

The .htaccess file should contain the following:

AuthName "My Private Web Area"
AuthType Basic
AuthUserFile /home/student/cst02/cst002933/public_html/resume/.htpasswd
require valid-user

To create the associated password file, student c002933 would need to use the 'htpasswd' utility as follows...

$ htpasswd -c ~/public_html/resume/.htpasswd username

...this will create an initial .htpasswd file in the resume directory to protect and set the first username/password pair. Replace "username" with an actual username.

NOTE: subsequent uses of the htpasswd command should not have the -c qualifier on it. This is only used to initially create the .htpasswd file.

Subsequent commands might look like:
$ htpasswd ~/public_html/resume/.htpasswd smith
...and htpasswd will interactively prompt for the new password to assign to the new username "smith".

If you actually looked at the .htpasswd file, this is what you would probably see:
smith:ZEM2rhIcTDaNU
plantem:ZEM2rhIcTDaNU
plantet:ZEM2rhIcTDaNU