RE: [PHP] Running PHP scripts with root permissions!!!

From: Date: Wed, 16 Aug 2000 14:46:36 +0000
Subject: RE: [PHP] Running PHP scripts with root permissions!!!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-12039@lists.php.net to get a copy of this message
I use sudo all the time on one of my machines. It takes this: su -c "tail -f /var/log/message" (password prompt) (type password) to this: sudo tail -f /var/log/message (password) Once you have that password typed, if you keep sudo-ing, it doesn't prompt unless it times out (1 minute on my machine). This saves a lot of typing of passwords. Mostly useful, though, is the fact that you can set up multiple sudoers, and restrict what they can do. For instance, my wife can only bring the LAN up and down, and that's all. That's not because I don't like my wife, but I'd hate to let her do anything and end up accidentally killing something important. She's less stressed, too. For the task of letting the web server look at the message file, you could setup a PHP or shell script that would do the tailing (something simple should do) and then in your PHP script do exec("/path/to/sudo /path/to/shell.script"); In your sudoers.conf file, you'd setup nobody (the web server) as able to sudo /path/to/shell.script and nothing else, and you should be fairly safe from your web server being told to send someone your /etc/passwd file. Hans On Wed, 16 Aug 2000, Chris Murley wrote: > Sudo is a program that lets you gives users on a machine root privs to do > certain task that you specify. > > > Very nice indeed ;-) > > On Wed, 16 Aug 2000, Krznaric Michael wrote: > > > I saw the other post use sudo? What's sudo? Do you mean set UID? > > > > Mike > > > > -----Original Message----- > > From: Web Admin [mailto:webadmin@morva.net] > > Sent: Wednesday, August 16, 2000 10:32 AM > > To: php-general@lists.php.net > > Subject: [PHP] Running PHP scripts with root permissions!!! > > > > > > Hi everybody, > > Does anyone know how to run php scripts with root permissions? > > For example, i want to write a php script which shows last system > > messages using tail /var/log/messages. > > How can I do that without chmod 777 /var/log/messages!! > > That's very very URGENT!! > > httpd is being run by nobody. Should I change it? The owner can't > > be root in Apache (latest version). > > Regards, > > Ahmad Anvari Hans Anderson ~ me@hansanderson.com PO Box 426, Missoula, MT 59806 | PHP, Search Engines, SQL (800)397-9116 / (406)549-6524 | Databases, Flash Multimedia, http://www.hansanderson.com | Killer Audio Production, http://www.goofiness.com | Minty Fresh Breath.

« previous php.general (#12039) next »