vitid Posted October 25, 2008 Share Posted October 25, 2008 hi, i have problem about php using ssh the problem is that i don't know how to respond to server's authentication request. for example : i use grid-proxy-init command and server will request me to enter the passphrase key (just to note that i didn't get a problem with login to server , i can login successfully but i don't know how to respond to server's request) here is my code: <?php if(!($con = ssh2_connect("xxxxxxxxx", 22))){ echo "fail: unable to establish connection\n"; } else { if(!ssh2_auth_password($con, "xxxx", "xxxxx")) { echo "fail: unable to authenticate\n"; } else { echo "okay: logged in...\n"; $cmd = 'grid-proxy-init -cert cert.pem -key userkey.pem'; //execute grid-proxy-init command and server will request me to type passphrase(password) if(!($stream = ssh2_exec($con,$cmd)) ){ echo "fail: unable to execute command\n"; } else{ //here i can't get this to work , it act like i just login //for example : if i type password = ls , it will display //all file in directory ; instead of recognize it as passphrase $stream = ssh2_exec($con,'password'); stream_set_blocking( $stream, true ); echo stream_get_contents($stream); fclose($stream); echo "success"; } } } ?> i try googling for 3 hours and can't find any answer very thank for your help and reply :) Link to comment https://forums.phpfreaks.com/topic/130082-help-with-php-ssh/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.