Page 1 of 1

Ssh connection via php script

Posted: Mon Dec 29, 2008 9:18 am
by Taisa
Hello. I`ve some problem, and don`t know how to deal with it. I have to make script that will be login via ssh on diffrent host, you could say "automatic/scheduled" connection for specified host. First I can`t use ssh2 libs in PHP. It doen`t work - why I don`t know. Probably because "anserw" from remote host comes too late (there`s no such arg like "timeout" in ssh2_connect)
That`s the error I get...

Code: Select all

[Warning: ssh2_connect(): Error starting up SSH connection(-5): Unable to exchange encryption keys in /root/php_skrypt.php on line 8
I think it isn`t a bug in libssh2, because when I conect form my server (debian) to the other server (debian too) it works perfect... Unfortenly with other hosts doesn`t work at all...
I can`t use the keys too... Is there any posibillity to connect over ssh using shell_exec? I tried but its prompt about password... Is there any chance to parse the output after its prompt about password, and just "paste" the password right there... I know it sound wierd but I don`t know how to start... Any help will be apreciated