SSH command from PHP script - nothing, yet work at cmd line

Posted by waxical on Server Fault See other posts from Server Fault or by waxical
Published on 2011-11-07T16:22:57Z Indexed on 2011/11/13 17:54 UTC
Read the original article Hit count: 254

Filed under:
|
|
|

I'm working on an EC2 box and trying to SSH command another box.

The command works in command-line, even php -a interactive. However it does not work when running as apache. Example cmd:-

   system('ssh -i /home/me/keys/key.pem [email protected] "ls"');

I've tried adding apache to wheel group, and gshadow on both boxes. I've also just tried chowning the pem file to apache. Nothing.

Yet the command response fine in the two other use cases outlines.

What's going on here? Anyone know?

© Server Fault or respective owner

Related posts about linux

Related posts about apache2