Our web server provides a means to control access by two different methods. The first method is to restrict where you can connect from, while the second method is to restrict who can connect to a page. Both methods require the use of a file called .htaccess in the directory you want to protect. Creating the .htaccess file is not done using FrontPage. You'll need to use something like SecureCRT or PuTTY to login to the server and create the .htaccess file at the shell prompt.

Getting to the Shell Prompt

If necessary download PuTTY to your computer. The following instructions assume that you are connected to the Internet. Using PuTTY do the following:

Figure 1:
Instructions for getting to the shell prompt
Open putty.exe

In the Host Name box enter: www.gpc.edu or facstaff.gpc.edu

Then in the Protocol section select the SSH radio button.

At the bottom of the screen, select the 
Always radio button to close the window when you exit. Click the Open button. Click Yes to the PuTTY Security Alert window. Then proceed to enter your person or departmental
email username and password. Follow all prompts. At the Main Directory, enter shell.

Restricting by Location

This type of restriction can be helpful if you have content that you only want people to be able so see if they are on a GPC campus.

Example Code

This example will show how to restrict a directory so that only people who are physically located on one of the campuses. It assumes that you have already created the pages using FrontPage and published them to the web server via FTP.
Figure 2: Example .htaccess  file for restricting by location
At the shell enter:
cd public_html press Enter
ls -a press Enter

cd directoryname press Enter
pico press Enter
Type the following code:

<Limit GET>
order deny,allow
deny from all
allow from gpc.edu
allow from gpc.peachnet.edu
allow from dc.peachnet.edu
</Limit>

Press CTRL + X to save and close the file.  
Press Y to save changes. Enter .htaccess then press Enter. Type exit at the shell prompt then press Enter.
Then follow the instructions from the Main menu to disconnect.

Restricting by Identity

This type of restriction only allows people assigned a username and password to access your pages. This method does NOT use the same password file that is available on the system. You have to create the password file, as shown below.
Figure 3: Example .htaccess   file for restricting by Identity
At the shell enter:
cd public_html press Enter
ls -a press Enter

cd directoryname press Enter
pwd then press Enter
(Make a note of the path that is returned.) pico press Enter
Type the following code:
(Be sure to note that the path you enter should
match the path you made note of earlier.
Pay special attention to the text in italics.)

AuthUserFile /u/staff/username/public_html/directoryname/passwd.db AuthGroupFile /dev/null AuthName ByPassword AuthType Basic   <Limit GET POST> require valid-user </Limit> Press CTRL + X to save and close the file.
Press Y to save changes. Enter .htaccess then press Enter. Type exit at the shell prompt then press Enter.

This method does NOT use the same password file that is available on the system. You have to create the password file, as shown below. (This example assumes you want to protect a directory that you would access via the web as http://www.gpc.edu/~username/directoryname).

Figure 4: Example commands to create the password file for restricting by Identity
At the shell enter:
cd public_html press Enter
ls -a press Enter

cd directoryname press Enter

htpasswd -c passwd.db login
Adding user login
New password:
Re-type new password:

In the above example, you should replace login with the username you want to create. If you have already created accounts for this directory, you should use the following commands, instead:

Figure 5: Example commands to add to the password file for restricting by Identity
At the shell enter:
cd public_html press Enter
ls -a press Enter

cd directoryname press Enter

htpasswd passwd.db login   (*)
Adding user login
New password:
Re-type new password:
*May have to chmod to 644 to reading db.