Password protecting web pages/directories
Here are the steps to password protect a www directory:
First, create a subdirectory under your public_html directory. In this example we'll call it DIR, the username being USER. So this would be accessible on the WWW as: www.math.ualberta.ca/~USER/DIR
Next, copy the following text into a file called .htaccess and save it to the DIR directory. Make sure you replace the bolded text with your own username!
If you have not previously password protected a www directory, you can set up a username and password by running the following command on one of the sirius servers:
htpasswd -c -m ~/.htpasswd guest
If you already have a .htpasswd file and you want to add to it, type:
htpasswd -m ~/.htpasswd guest
Make sure the ~/.htpasswd file has read permission for all users. You can use the following command to set it to the correct permissions:
chmod 755 ~/.htpasswd
You can create multiple usernames and/or password protect multiple directories.
Now if someone tries to view a web page located in your password protected www directory, they will be prompted for a username and password before being allowed to proceed.
go back to main page