Good day,

A bit off topic, but you can run a Perl script setuid.  You have to pass a
flag to Perl to let it know that it's OK, though (it's -U, I believe) which
would appear in your first "she-bang" line.

I've never had to run a PHP script setuid.  I would imagine that one would
have to write it CGI-like instead of via the server module.

Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948

-----Original Message-----
From: Ken Nagorski [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 10:37 AM
Subject: [PHP] running commands as root from a script

Hi there,

I have a little problem. I need to run a few commands for Courier from a
script. What I have is a php based application that makes it easy to create
and manage virtual domains and the addresses for them from the web. However
when You "Apply the changes" everything is written to /tmp dir and the a
little perl script parses the file and moves things where they need to go
and then runs couriers makealiases command. Now you can't run a perl script
SUID so I wrote a C program that just calls system() and runs the script and
it is SUID. This doens't work however. No matter what I do. It is like
Courier ignores this.

I can't imagine there isn't anyone who has not run into the problem of
automating things via PHP and not had to run a system command as root at
some point in time. I am wondering what the different approaches to this
problem are.


PHP General Mailing List (
To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to