Subject: Re: Re-authenticate

Re: Re-authenticate

From: Peter Stuge <>
Date: Wed, 20 Jun 2012 03:57:55 +0200

Casper Langemeijer wrote:
> re-use a SSH connection for several log ins (authentications)

This is correct. The SSH protocol only ever does authentication once
for every session, at the beginning. After the session is
authenticated then it is possible to open many channels.

libssh2 exposes both these things in the API.

> re-authenticate a second time.
> Can this be done with libssh2?

Can you explain in more detail what you want to do?

> Can this be done with the ssh protocol at all?

After a session passes authentication there can be many channels.
Everything you use SSH for is a channel. The PHP plugin can choose
to reuse sessions transparently, in order to avoid creating new

But under no circumstances can a single session be authenticated more
than once. That also does not make sense in protocol terms. Please do
look at the protocol RFCs. They are very very easy to read.

Received on 2012-06-20