Take a look at Chris Johnson's Test Bed
I have a simple page with a text box and a submit button. When i press the button I want to run a small bash script with the value in the text box as input and show the result in web page.
These are the scripts I use. Happy to get suggested if you have simple ones.
root@cpaneltest [/usr/local/apache/htdocs/test]# cat index.html
<div align="center" style="margin-top:275px;">
<form action="ip.php" >
IP Address: <input type="text" name="ip" />
<input type="Submit" value="Ping"/>
root@cpaneltest [/usr/local/apache/htdocs/test]# cat ip.php
$ip = $_GET['ip'];
#$cmd = .adduser .. $u;
$cmd = .echo $ip;
$out = system($cmd);
The web server run as apache or www-data or www user. The addusre command need to be run as root user. The only solution is to run adduser using sudo without password which is a huge security risk.
All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]
There are currently 1 users browsing this thread. (0 members and 1 guests)