how to execute a remote command from php
| From: | Victor Alvarez | Date: | Mon, 27 Sep 2004 16:35:09 +0000 |
| Subject: | how to execute a remote command from php | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-197976@lists.php.net to get a copy of this message | ||
Hello,
Since last week I am trying to execute a remote machine command from php without success. Since
ssh ask for a password, I managed to use ssh with dsa authentication so it's possible to call
the remote command without password and only with one line: ssh -l victor 192.168.129.211 -i
/root/.ssh/id_dsa "whoami". It works perfectly from command line but I have nothing if I
try to do the same from php: exec("ssh -l victor 192.168.129.211 -i /root/.ssh/id_dsa
\"whoami\"",$results); $results is empty after the execution.
I wonder if somebody could answer this question. I have found no solution googling it.
Thank you.
Regards,
Victor.