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

David Thacker David at ThackerNet.com
Thu Oct 11 12:41:38 -05 2012


>> If you copy /etc/httpd/conf.d/perl.conf to /etc/admserv/conf.d/ and
>> restart AdmServ, it'll execute Perl scripts. But the scripts from the
>> RaQ4 might still not work, because it could be that they require RaQ4
>> specific libraries which BlueOnyx doesn't have.

I tried that, and was not successfull -- it still just displayed the 
script when named .cgi or the browser tried to download it when named .pl. 
So, I decided to rewrite the Perl script in PHP instead. How hard could it 
be?

I found a couple fantastic references that made the conversion to PHP 
super easy by giving side by side comparisons of both languages:

http://hyperpolyglot.org/scripting

http://www.cs.wcupa.edu/~rkline/perl2php/


Anyway, my rewritten PHP script now works fine EXCEPT that I get a 
Permission Denied error when it actually goes to create the symlink.

My form html and PHP pages are both in a subfolder of the 
/usr/sausalito/ui/web folder. When I submit the form, the debug output on 
the script shows that I am passing and parsing the variables just fine. 
When my script gets to the part where it calls the PHP symlink function, I 
get this error message:

Warning: symlink() [function.symlink]: Permission denied in 
{scriptname.php} on line 124

The symlink source dir is owned by root, permissions 0755. The target dir 
is owned by the siteadmin:group of the site it is created in, with 
permissions 2755.

If I manually create a symlink from the commandline (logged in as root), 
it succeeds.

I am guessing that the PHP script is failing because it is not running as 
root, even though it is running via admserv and not regular httpd.

Are there any ideas on how to resolve this permission denied problem?

Regards,

David Thacker 




More information about the Blueonyx mailing list