Re: running commands as root from a script
| From: | Steve Edberg | Date: | Fri, 29 Mar 2002 00:05:35 +0000 |
| Subject: | Re: running commands as root from a script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-90613@lists.php.net to get a copy of this message | ||
I have done a similar thing by executing another script via sudo using the PHP command passthru() (or you could use exec(), system(), whatever's appropriate). See
http://www.courtesan.com/sudo/for more info. The whole setup was (and is) a bit of a kluge, but the script didn't need to be run often so it doesn't impact server performance any.
-steveAt 09:37 AM 3/28/02 , Ken Nagorski wrote:
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. Thanks Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php+------------------------------------------------------------------------+
| Steve Edberg sbedberg@ucdavis.edu | | Database/Programming/SysAdmin (530)754-9127 | | University of California, Davis http://pgfsun.ucdavis.edu/ |+---------------------- Gort, Klaatu barada nikto! ----------------------+