|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2005-08-29 09:59 UTC] pear dot 20 dot fab at spamgourmet dot com
 Description:
------------
Hi,
unfortunately it is not possible to re-use a SSH connection for several log ins (authentications). This would be *very* useful because it takes ages to establish a ssh connection, so one could save a lot of time if it were possible to re-login via ssh2_auth_password().
Btw, the server hangs up if one tries to re-authenticate a second time.
Reproduce code:
---------------
$con = ssh2_connect("server");
ssh2_auth_password($con, 'username', 'secret');
ssh2_auth_password($con, 'username', 'secret');
echo "program will never reach this point";
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 10:00:02 2025 UTC | 
Description: ------------ LibSSH2 0.18, PECL/ssh2 0.10 I could re-authenticate second time with following code: Reproduce code: --------------- $ssh2_host = '127.0.0.1'; $ssh2_user = 'volkan'; $con=ssh2_connect($ssh2_host, 22); if ($con == false){ die('conn err'); } if (ssh2_auth_password($con, $ssh2_user, 'wrongpass')) { echo 'Auth 1 SUCCESS'."\n"; } else{ echo 'Auth 1 failed.'; if (ssh2_auth_password($con, $ssh2_user, 'correctpass')) { echo 'Auth 2 SUCCESS'."\n"; } else { echo 'Auth 2 failed.'."\n"; } } OUTPUT: ------- Auth 1 failed. Auth 2 SUCCESS