>I was wondering, if anyone can help me with running system commands from >within php. Actually I have a script which deletes users from my database >(which is of course MySQL), now I want to delete those users from system >level also, as they are authenticated users of my OS also. > >Now, the problem is, that I'm running my MySQL server and web server on >different machines. I can do whatever on remote DB server but how to run >a system command on another machine. I know, it's possible to run system >commands on local server by system(), but what about remote server?
This is partially dependent on the user your php scripts are running as. One approach might be to use SSH to talk to the remote machine, and set up a limited-privilege account there. You can run a copy of ssh-agent[1] as the apache user, which stores an open copy of a private SSH key in memory, add the public half of that key to the remote machine's authorized_keys file[2], and use SSH to access that machine. [1] http://www.phil.uu.nl/~xges/ssh/ [2] http://www.nevis.columbia.edu/cgi-bin/man.sh?man=ssh --------------------------------------------------------------------- michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php