|
Posted by Oscar Gosdinski on 05/14/05 02:16
Hello everybody:
I need my PHP application connects through SSH to other server for
getting some info to display and i tried the following code to test
lib ssh2:
$server = ...;
$user = ...;
$passwd = ...;
$con = ssh2_connect($server, 22);
if (ssh2_auth_password($con, $user, $passwd)) {
$s = ssh2_exec($con, 'ls -l');
$file = fopen("/tmp/test", "w");
while ($line = stream_get_line($s, 1024)) {
fwrite($file, $line);
fflush($file);
}
fclose($file);
} else {
echo "Authentication Error";
}
The file /tmp/test was created but it does not have any data. I can
connect to the server using a normal ssh session in my laptop and the
'ls -l' command returns me information.
I think that i installed correctly the ssh2 functions because if a put
an incorrect password i get the "Authentication Error" message.
I searched the web for info about similar problems and no results.
Please, anyone can help me with this problem because i have been
spending three days with this.
Thanks in advance for your answers.
--
Saludos / Regards
Oscar
[Back to original message]
|