[BlueOnyx:11529] Re: Need CGI script to execute command as root

Ken - Precision Web Hosting, Inc kenlists at precisionweb.net
Fri Oct 12 11:54:09 -05 2012


----- Original Message ----- 
From: "David Thacker" <David at ThackerNet.com>
To: "BlueOnyx General Mailing List" <blueonyx at mail.blueonyx.it>
Sent: Friday, October 12, 2012 9:32 AM
Subject: [BlueOnyx:11528] Re: Need CGI script to execute command as root


> Hi Michael,
>
>>> I am a little baffled as to why my existing PHP script fails to create
>>> the
>>> symlink with a permissions error when it is running as root. More
>>> testing
>>> and/or reading required, apparently...
>>
>> Neither AdmServ nor Apache run PHP scripts as root. Because that would
>> be quite a security risk.
>
> Ahh. I included this in my PHP script for debugging:
>
>    echo get_current_user();
>
> and it spits out "root" when I run via admserv. When I run that same
> script in a regular site it spits out the siteadmin instead of root.
> That's why I thought admserv was running the script as root.
>
> I was thinking the permissions error was related to the restrictions on
> the symlink function when running in safe mode, as per this list:
> http://php.net/manual/en/features.safe-mode.functions.php
>
>
> Okay, I guess I will pursue the cron job approach as suggested by others.
>
> Regards,
>
> David Thacker
>


David

You could have a php script send an email.
Then have a perl script run from a cron job that parses the contents of that 
mbox and acts on it.

I do something similar for customers that want to bock IP addresses but 
don't want to ssh.


Ken







More information about the Blueonyx mailing list