Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Remote Administration using Apache mod_perl

by tachyon (Chancellor)
on Sep 05, 2003 at 02:34 UTC ( [id://289086]=note: print w/replies, xml ) Need Help??


in reply to Remote Administration using Apache mod_perl

This is about as basic as you can get. You get a textbox to type commands into and a run button. Output goes to browser. Probably needs a little work on the security side ;-)

The practical problem you face is that Apache will be running as user nobody or apache (ie not you) so you will be limited in what you can do. There are of course solutions to this problem.

#!/usr/bin/perl $|++; use CGI qw( :standard ); use CGI::Carp qw( fatalsToBrowser ); my $command = param('command'); print header, start_form({ -method=>'get' }), textfield({-size=>75,-na +me=>'command'}), submit('Run'), end_form; if ($command) { open( CMD, "$command 2>&1|" ) or die "$!: running command: '$command +'"; print "<pre>"; print escapeHTML($_,1) while<CMD>; print "</pre>\n", end_html; close CMD; }

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://289086]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-03-28 17:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found