[PLUG] How to execute a shell script from an html web page

Abhijit Bhopatkar bain at devslashzero.com
Thu Mar 11 08:43:47 PST 2010


>> Hey all,
>>      I wish to execute a shell script from a simple html page. When I click
>> on a submit button on the html page the script should execute. How do I do
>> this? Any help is appriciated...
> Most langs have something like a SYSTEM() function.
>
> Like in python
>
> import os
>
> os.system(" sh ~path-to-your-script ")
>
> that should do it.

Be careful though,
if the script runs with priviledges an "rm -rf /" will be devestating.
And anybody with http access will be able to carry it out.
A less damaging part will be wiping out whatever the web server has
access to do.

Side point: The command executed this way will inherit web server's
privileges. (unless suid bit is set on the execs ... but everyone
knows not to do that).

Abhijit



More information about the plug-mail mailing list