kshAuth - Authentication and Authorization Interface for Apache 2.2+ Web Server

Version 0.2


Instructions to Change Top Level kshAuth Directory

Instructions for changing the top level directory used as the authorization structure to something other than "kshAuth".

To use "kshAuth" you MUST use at least one directory level below the apache "htdocs" directory as your structure. This document assumes the following Apache directory structures:

Under this Apache structure, a sub-directory named "css" will be used as an example for changing the top level kshAuth from "kshAuth" to "css".

Create the "CGI" program directory for the new "css" structure:

mkdir /usr/local/apache2/cgi-bin/css

Create the document directory for the new "css" structure (this probably already exists on your system since this is what you are changing kshAuth to use, but if not...) :

mkdir /usr/local/apache2/htdocs/css

Create the authorization structure directory to contain the password files and such:

mkdir /usr/local/apache2/css

Copy the "kshAuth" files from their default locations to these new directories:

cp  /usr/local/apache2/cgi-bin/kshAuth/*   /usr/local/apache2/cgi-bin/css
cp  /usr/local/apache2/kshAuth/.[a-zA-Z]*  /usr/local/apache2/css

Edit all CGI files and change "/kshAuth/" to "/css/":

cd /usr/local/apache2/cgi-bin/css

for FILE in *
do
    echo "${FILE}"
    sed -e "s|/kshAuth/|/css/|g" < "${FILE}" > /tmp/tmp${$}.out
    mv /tmp/tmp${$}.out "${FILE}"
done

If you also wish to copy the kshAuth document directory files (not required or necessary), then do the following:

cp -Rp /usr/local/apache2/htdocs/kshAuth/*   /usr/local/apache2/htdocs/css
cd /usr/local/apache2/htdocs/css
for FILE in $( find . -type f -exec grep -l '/kshAuth/' {} \; )
do
    echo "${FILE}"
    sed -e "s|/kshAuth/|/css/|g" < "${FILE}" > /tmp/tmp${$}.out
    mv /tmp/tmp${$}.out "${FILE}"
done

When file copying and editing is complete, then change the ownership and group membership of all files to the apache web server owner and group specified in the http.conf file. The following examples assume the owner and group is daemon and daemon:

chmod 755 /usr/local/apache2/cgi-bin/css/*
chmod 600 /usr/local/apache2/css/.[a-zA-Z]*
chown -R daemon:daemon /usr/local/apache2/cgi-bin/css
chown -R daemon:daemon /usr/local/apache2/htdocs/css
chown -R daemon:daemon /usr/local/apache2/css