I'm not experienced PHP, C, Linux or BSD user I can only tell you what I done. Repeat my experiment to see that exactly is happening.
everything is done by virtual box - bought ubuntu and freebsd are virtual machines hosted on laptop I setup ubuntu server with php5 apache libssh2 read this artiche http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/ (view the article for PHP example and how I setup libssh2) and I setup FreeBSD server with no additional software (there are some small confugurations in sshd_config but they are no important now(enable root log in)) (after install them view virtualbox settings and bridge the ethernet adapters. The two machines must see each other) Then I tried to send command via SSH using libssh2 Furst I manually from ubuntu's terminal type to see can I connect to FreeBSD via ssh ssh rcbandit@ - then it asked to confurm the key - it worked and I login. And I also try root log in via ssh just for experiment. I created a small file in ubuntu - /var/www/test.php and I run it with mozilla firefox This is the test.php file <?php if(!($con = ssh2_connect("192.168.1.140", "22"))){ echo "fail: unable to establish connection\n"; } else { if(!ssh2_auth_password($con, 'rcbandit', 'qwerty')) { echo "fail: unable to authenticate\n"; } else { if(!($stream = ssh2_exec($con, "uptime" )) ){ echo "fail: unable to execute command\n"; } // collect returning data from command else{ stream_set_blocking( $stream, true ); $data = ""; while( $buf = fread($stream,4096) ){ echo "$buf"; } fclose($stream); } } } ?> *uptime command is just example and when I run it gives me this Warning : ssh2_auth_password() [ function.ssh2-auth-password ]: Authentication failed for rcbandit using password in /var/www/test.php on line 8 fail: unable to authenticate when I try to connect ubuntu and ubuntu or debian server it worked very well I really don't know really why it don't work. Excuse for my bad english but English is not my native langlage. Regards >-------- Оригинално писмо -------- >От: Peter Stuge >Относно: Re: >До: [email protected] >Изпратено на: Понеделник, 2009, Октомври 5 19:21:33 EEST >sdcsdc sdcsdc wrote: >> libss2 worked well between linux servers but it gives error when I >> try to connect Ubuntu and FreeBSD > >Please help us debug this. Of course we want libssh2 to work both >running on, and talking to, FreeBSD hosts. > > >> I dont know why libssh2 don't work when I try to connect ubuntu and >> FreeBSD > >We do not know either, which means you are the only one who can find >out right now. Please help with that. Use the simple C examples, >build a libssh2 with debugging enabled, and enable tracing in the >code. It would also be helpful to see debug output from the server. >I guess FreeBSD is running OpenSSH, then you can stop sshd and start >it manually using /usr/sbin/sshd -ddd and then try to connect. You >will get some debugging info there as well, which might be helpful. > > >//Peter >_______________________________________________ >libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel >
_______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
