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

Owais Lone loneowais at gmail.com
Thu Mar 11 08:56:20 PST 2010


On Thu, Mar 11, 2010 at 10:13 PM, Abhijit Bhopatkar
<bain at devslashzero.com>wrote:

> >> 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
>
> _______________________________________
> Pune GNU/Linux Users Group Mailing List
>

See if your webserver offers an API. Webfaction has a XML-RPC API. I
actually use it to run a couple of script thought my blog.

-- 
Owais Lone
hello at owaislone.org
http://www.owaislone.org


More information about the plug-mail mailing list