|
CSCI A348/A548Handin Info Fall 1999 |
1. Set up Apache access control based on username and password
Part I: Creating and Maintaining Passwords.
Take
and put it in your directory/u/dgerman/bin/htpasswd
/u/username/bin
where you also have starthttpd.
Use it to add a new username dgerman: call
the program with a -c switch on the command
line to create the password file and specify the location
of this file. Here's an example session that assumes I
decided to keep the passwords in a file that is called
passwd and that is located in my server's
root directory. Then my session could look like this:
Next time you want to add a new user you don't need to runtucotuco.cs.indiana.edu% htpasswd -c /u/dgerman/httpd/passwd dgerman Adding password for dgerman. New password: Re-type new password: tucotuco.cs.indiana.edu% ls -l /u/dgerman/httpd/passwd -rw-r--r-- 1 dgerman students 43 Dec 8 12:59 /u/dgerman/httpd/passwd tucotuco.cs.indiana.edu% file /u/dgerman/httpd/passwd /u/dgerman/httpd/passwd: ascii text tucotuco.cs.indiana.edu% cat /u/dgerman/httpd/passwd dgerman:ePFse8ZfrQnf6 tucotuco.cs.indiana.edu%
htpasswd with a
-c switch, the switch is used only for
the creation of a new password file. This is
how you create and maintain password files: with
htpasswd and it's up to you where you
store them. Part II: Password Protecting Directories.
Create a directory assignments in your htdocs.
Change your access.conf file to allow access only to
username dgerman whose password is kept in the file you
created with htpasswd.
<Directory /u/dgerman/httpd/htdocs/assignments>
AuthName Protected
AuthType Basic
AuthUserFile /u/dgerman/httpd/passwd
<Limit GET>
require user dgerman
</Limit>
</Directory>
Restart your server.
Send me the password you have set up for this directory
(for username dgerman) so that I can check
your assignments as you post them.
Note:
Make sure the protection on the files you place in this directory are set to read write (and perhaps execute) for the owner only.If I can get to your files other than through a password protected web directory you may lose points.