How to Install

This is an installation procedure for Redhat-7.1, 7.2 and 7.3. I presume that the cgi program will be installed in /var/www/cgi-bin/useraddbyweb/ and the html program in /var/www/html/useraddbyweb/.

Install useraddbyweb as root. This makes the installation much easier. I presume that the source program is in /root/useraddbyweb.tar.gz

o untar the software

tar xvfz useraddbyweb.tar.gz
cd useraddbyweb-20010630

useradd_wrapper requires the UID of the one executing this program. Since this will be run by the cgi program,, it is run by the web server. In Redhat-7.1, 7.2 and 7.3, this user is apache. So get the UID of apache for your server.

cat /etc/passwd | grep apache

In my server, the UID and GID of apache is 48.

o Edit useradd_wrapper.c and change:

 line 47:
#define ALLOWED_UID 420 ==> #define ALLOWED_UID 48

line 404:
comment this out: /* exec_chfn(username, name); */
With this line, an error is issued after creating the user account successfully.

o Edit and change :

line 135:
system ("./useradd_wrapper", $username, $name, $password) == 0
==> system ("/var/www/cgi-bin/useraddbyweb/useradd_wrapper", $username, $name,
            $password) == 0

It is necessary to use the full path to useradd_wrapper, otherwise perl will complain about "Insecure $ENV{PATH}."

All calls to subroutine (lines 30 to 34) must be prefixed with &, otherwise perl will complain about "called too early to check prototype."


&check_username_existence ($username);
&create_user ($username, $name, $password1);
&log_user ($username, $name, $country, $yearofbirth);
&emit_user_created_page ($username);

In line 161, sub emit_user_created_page($), just after the first '{' and before the print statement, add a line:

my ($username) = (@_);

o Edit useraddbyweb.html and change line 20:

<FORM action="" method="post">

==> <FORM action="" method="post">

Again, the full path is required.

o Edit Makefile and change line 1:

CC = gcc-2.95 ==> CC = gcc

o Compile


o Create placement directories and copy the necessary files:

mkdir /var/www/html/useraddbyweb
cp useraddbyweb.html /var/www/html/useraddbyweb/

mkdir /var/www/cgi-bin/useraddbyweb
cp incorrect_input.thtml /var/www/cgi-bin/useraddbyweb/
cp user_created.thtml /var/www/cgi-bin/useraddbyweb/
cp user_exists.thtml /var/www/cgi-bin/useraddbyweb/
cp useradd_wrapper /var/www/cgi-bin/useraddbyweb/
cp /var/www/cgi-bin/useraddbyweb/

The directory Modules and all the  files under it must be moved to where your perl places its .pm files:

mv Modules /usr/lib/perl5/5.6.1/

o All the files must be owned by root:apache. The executable files must be setuid root, otherwise they cannot do what they intend to do.

cd /var/www/cgi-bin/useraddbyweb
chown root:apache *
chmod 4755 useradd_wrapper
chmod 4755

o Installation is finished. Use your browser to point to:

and everything should work fine. Cross your fingers!

Fr. V. Chua, S.J.