[KLUG Members] cgi file not found

Bruce Smith members@kalamazoolinux.org
Fri, 14 Sep 2001 10:58:43 -0400


1) Your apache config file must have that directory set to
run CGI files, and the *.cgi extension must be set as a CGI file.

2) Since you can't run the file locally, #1 may not be your problem.
It sounds like the partition containing the CGI file is mounted 
without "exec" permissions.  Check your /etc/fstab.

3) Be careful coding your CGI scripts in BASH!
   HUGE potential security holes await you!!!!


> One of our developers is trying to learn cgi. He put this pinggeneric file on our linux developement server. If I ssh into the server and start konqueror, I see the file, I can right click on it and open it in an editor but if I left click on it I get a message that the file is not found. This is also the message that comes up in the developers browser when he tries to run the script. Does anyone know why the system can't find a file that is obviously there?
> 
> [root@localhost cgi-bin]# ls -l
> total 8
> -rwxrwxr-x    1 root     nobody        289 Sep 14 08:17 pinggeneric
> -rwxrwxr-x    1 root     apache        289 Sep  6 07:12 pinggeneric.cgi
> [root@localhost cgi-bin]# exec ./pinggeneric
> bash: /var/www/cgi-bin/pinggeneric: No such file or directory
> bash: /var/www/cgi-bin/pinggeneric: No such file or directory
> [root@localhost cgi-bin]# pwd
> /var/www/cgi-bin
> [root@localhost cgi-bin]# cat pinggeneric
> #!/bin/sh
> 
> echo Content-type: text/html
> echo
> echo "<HTML><HEAD>"
> echo "<TITLE>Are You There?</TITLE>"
> echo "</HEAD><BODY>"
> ison='who | grep "${1}"'
> if [ ! -z "$ison" ]; then
>     echo "<P>$1 is logged in."</P>
> else
>     echo "<P>$1 isn't logged in."</P>
> fi
> echo "</BODY></HTML>"


--------------------------------------------
Bruce Smith                bruce@armintl.com
System Administrator / Network Administrator
Armstrong International, Inc.
Three Rivers, Michigan  49093  USA
http://www.armstrong-intl.com/
--------------------------------------------