Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Shutdown through CGI-Script

by DeepakBasavaraj (Initiate)
on Mar 17, 2006 at 11:01 UTC ( #537429=perlquestion: print w/replies, xml ) Need Help??

DeepakBasavaraj has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am not able to shutdown down remote machine through html parsed cgi-script, but i am able to do through command, i have apache server running, os win xp sp2, firewall is disabled, but still apache server says Access denied Here is the code system "shutdown -f -r -m \\computername"; Apache server dispalys-C:\Program Files\Apache Group\Apache2\cgi-bin\script.cgi -- shutdown -f -r -m \\computername --->access denied

Replies are listed 'Best First'.
Re: Not able to shutdown the remote machine through html parsed cgi scripts
by davorg (Chancellor) on Mar 17, 2006 at 11:17 UTC

    I don't know much about Apache on Windows, but almost certainly the web server process doesn't have permission to run the shutdown program.

    Personally, I'd see that as a feature!

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re: Shutdown through CGI-Script
by inman (Curate) on Mar 17, 2006 at 11:46 UTC
Re: Shutdown through CGI-Script
by idle (Friar) on Mar 17, 2006 at 12:03 UTC
    In addition to inman reply, you can use standart win utility '%systemroot%\system32\runas' to run command with different credentials.
      Not that this has anything to do with Perl but I'd be very wary of using runas or psexec or any other mechanism that would allow code executing under the user ID of the web server to perform arbitrary actions as an admin user.
        both runas and psexec will allow you to execute a programme as Administrator, provided you supply the password. That being said, putting your Administrator password in a script is probably just aching for a problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://537429]
Approved by xdg
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2019-07-20 07:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?