Hi everyone,
I want to kill process through the web, so I create html page with single bottom that run kill command in shell script with CGI.
Here is html code:
<td><form METHOD="GET" action="http://IP:port/cgi_bin/script.cgi" > <input type="submit" value= "Submit" > <INPUT name="q" value="mysql"> </Form></td>
when I hit submit expect run this command on shell "pkill mysql" but not execute it !
I don't find appropriate command for script.cgi!
do you have idea?
jgt
September 18, 2018, 12:41pm
2
my first guess is that the user that the the web server runs as, does not have permission to kill the process.
Run with root user, and give execution permission to script. But problem stiil exist.
jgt means: the cgi script runs as the webserver user:
ps -ef | grep http
Webserver and cgi run with root user.
CGI as root has security risks.
Maybe your webserver refuses to run CGI scripts as root? Check the Web server logs!
You right i�m just testing with root user after that run script with limited user.
Actually i�m not sure cgi script is correct or not!
Do you know what is the sample of correct cgi script that run kill command on shell?
Thanks,
I don't remember any, but here is a debugging tip:
let the script output to a test file, like
#!/bin/sh
echo "
PATH=$PATH
arg0=$0
arg1=$1" > /tmp/tmpfile.tmp
Then check the contents. (And the file owner.)