Using sudo from a PHP Script

Ryan ryan at vbnet.net
Sat Apr 19 11:15:56 EDT 2003


I'm new to using sudo and I had a question about its
capabilities/features. I'd like to run some administrative scripts that
I've created from a PHP script running on my web server. Unfortunately,
these scripts need to run as root to do a few various things. sudo was
recommended to be as the best way to switch users to run a program. To
make things easier on the programming side of things (and for better
security), is there a way to force sudo to ask for the password every time
(i.e. disable the timestamps)? Also, is there a way to get sudo to accept
the password on a given file descriptor so it doesn't mess up data I may
be passing on STDIN (sort of like GnuPG)?

If I can get all this to work, what would be the best way to sudo to root
without using the password for the user running the web server or for the
root user? I'd like to maybe put some kind of arbitrary password on these
scripts so that if someone does steal this "admin" password, they won't
have my root password.

Any suggestions would be very much appreciated. Thanks in advance!

Ryan
ryan at vbnet.net


More information about the sudo-users mailing list