Hey folks,
Iam trying to call the ssh program and have it connect to a remote host and
authenticate, however I havent been able to do it. I used this script but all
i get when I run it on port 80 is:
command returned 255
At the error log i specified i get:
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password,keyboard-interactive).
Note that it doesnt even ask for a password.. just says denied immediately.
<?php
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will readfrom
1 => array("pipe", "w"), // stdout is a pipe that the child will writeto
2 => array("file", "tmp/error", "a") // stderr is a file to write to );
$process = proc_open("ssh -T -l user server.com", $descriptorspec, $pipes);
if (is_resource($process)) {
// $pipes now looks like this:
// 0 => writeable handle connected to child stdin
// 1 => readable handle connected to child stdout
// Any error output will be appended to /tmp/error-output.txt
//fwrite($pipes[0], "password"); //I have tried with and without writing
anything however its the same.
while(!feof($pipes[1])) {
echo fgets($pipes[1], 1024);
}
fclose($pipes[1]);
//fclose($pipes[0]);
$return_value = proc_close($process);
echo "command returned $return_value\n";
}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php