How do I restrict access on a web page in userpages.umbc.edu?
New userpages sites are no longer able to be created. If you are creating a website for class or instructional purposes, please use the Student Web Environment.
The following information is retained only for legacy purposes and is out of date.
Alert
This process is no longer supported by DoIT. However, it still may work.
Tell me
- Start an SSH session (Putty, TeraTermSSh, or Mac OS X Terminal utility).
- Log into gl.umbc.edu using the same username and password as myUMBC.
At the prompt change the directory to your www directory
Type:/afs/umbc.edu/users/<1st character of your myUMBC username>/<2nd character of your myUMBC username>/<your myUMBC username>/pub/www
For example:
username = jdoe1
www directory path = /afs/umbc.edu/users/j/d/jdoe1/pub/wwwYou can check what directory you are on by type 'pwd' which stands for print working directory.
Navigate to the directory you want to restrict
From the above example, type:cd images
- Type nano .htaccess
Enter the following text:
AuthName "Description of the login" AuthType Basic AuthUserFile .wwwusers require valid-user
- Hit CTRL+X to exit out of nano.
- Hit Y to save the changes.
Please make sure the file is saved as .htaccess - Create a list of valid users and the password to use.
- In order to have a directory password protected, you must create a set of usernames and passwords that are allowed. You should create a login for everyone you want to have access. To create the users, you first need to pick a file location. I used a file called .wwwusers in the same directory as my .htaccess file.
To create the file that contains the allowed users, you will need to use a tool called htpasswd. If you just run it, it will give the syntax that it requires. Here is a basic example of creating a password file for a GL home page:
linux1% cd ../pub/ linux1% pwd /afs/umbc.edu/users/j/d/jdoe1/pub linux1% nano .htaccess linux1% htpasswd Usage: htpasswd [-c] passwordfile username The -c flag creates a new file. linux1% htpasswd -c /afs/umbc.edu/users/j/d/jdoe1/pub/.wwwusers guest Adding password for guest. New password: Re-type new password: linux1% ls -al .wwwusers -rw-r--r-- 1 jdoe1 research 20 Jan 9 16:55 .wwwusers