php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #56516 Only one log in possible per SSH connection
Submitted: 2005-08-29 09:59 UTC Modified: 2012-06-20 14:31 UTC
From: pear dot 20 dot fab at spamgourmet dot com Assigned:
Status: Not a bug Package: ssh2 (PECL)
PHP Version: 5.0.3 OS: Fedora Core 4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pear dot 20 dot fab at spamgourmet dot com
New email:
PHP Version: OS:

 

 [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";


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-29 10:02 UTC] pear dot 20 dot fab at spamgourmet dot com
PS: I'm using PHP 5.04 and SSH2 0.9
 [2005-08-29 10:05 UTC] pear dot 20 dot fab at spamgourmet dot com
typo
 [2008-05-08 22:56 UTC] volkirik at yahoo dot com dot tr
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
 [2012-06-13 21:08 UTC] langemeijer@php.net
The libssh2 library does not support re-authenticate.

I asked the libssh2 developers if this could be possible in the future. I doubt 
it though. I don't think it's possible to switch user with the ssh protocol.

Do you know of any other ssh client that does this?
 [2012-06-13 21:08 UTC] langemeijer@php.net
-Status: Open +Status: Feedback
 [2012-06-20 14:31 UTC] langemeijer@php.net
As I expected: neither the libssh2 library or the ssh protocol support this.

It can't be done.
 [2012-06-20 14:31 UTC] langemeijer@php.net
-Status: Feedback +Status: Not a bug
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 12:01:28 2025 UTC