#!/bin/csh -f # # Author: Ram Samudrala (me@ram.org) # Version: O1.0. # Detail: # January 1, 1997. # # Set up by-passwd user authentication for a particular directory. # Make sure no slash appears at the end; it will be automatically added # Edit for your preference. # Directory where the htaccess file is set htaccess_location = "." # Directory where the htpasswd file is set htpasswd_location = "." # Directory where the htgroup file is (default is htpasswd_location) set htgroup_location = $htpasswd_location # Directory where the profile database file is (default is # htaccess_location) set profile_location = $htaccess_location # Name of the htaccess file set htaccess_filename = ".htaccess" # Name of the hpasswd file. set htpasswd_filename = ".htpasswd" # Name of the htgroup file set htgroup_filename = ".htgroup" # Name of the profile database file set profile_filename = "profile.info" # Name of the authoraisation group set auth_name = "SomeGroup" ############################################################## # You shouldn't need to change any of this. # Create a htaccess file # echo "Creating $htaccess_filename in $htaccess_location" cat < $htaccess_location/$htaccess_filename AuthUserFile $htpasswd_location/$htpasswd_filename AuthGroupFile $htgroup_location/$htgroup_filename AuthName $auth_name AuthType Basic require group $auth_name EOL # Create a htgroup file with the right group name # echo "Creating $htgroup_filename in $htgroup_location" echo -n "$auth_name" > $htgroup_location/$htgroup_filename echo ":" >> $htgroup_location/$htgroup_filename # Create a blank htpasswd file. This step is not really # necessary. # echo "Creating $htpasswd_filename in $htpasswd_location" touch $htpasswd_location/$htpasswd_filename # Create a default profile database. The format of the profile # database is as follows: The first line must begin with a # comment (#). Following that is the number of fields, and following # that is the name of the fields separated by |. The last field # should end with a |. This obviously means that | characters in # in the text of the profile will break this program. This is # inexcusable, really. There is however a check to prevent # people from using this character in the entry fields. # echo "Creating $profile_filename in $profile_location" echo "# 7 Username|E-mail|Street|City|State|Zip|Country|" > $profile_location/$profile_filename echo "#" >> $profile_location/$profile_filename echo "Done." # end