error: Key exchange failed. The session was closed by the remote connection end. ?

0 votes
asked Oct 10, 2016 by frannr (120 points)

why this error??
how to solve??

****this is my code:****

Dim client As Rebex.Net.Sftp = New Rebex.Net.Sftp
Dim res As Rebex.Net.SftpItemCollection

    Dim HOST_CASER As String = "ftp.caser.es"

    client.LogWriter = New Rebex.FileLogWriter("C:\MultiTarificador2016_XXX\log.txt", Rebex.LogLevel.Debug)
    client.Connect(HOST_CASER, 22)
    client.Login("user", "pass")

    res = client.GetList()

and this is my LOG:

2016-10-10 16:59:59.243 Opening log file.
2016-10-10 16:59:59.264 INFO Sftp(1)[9] Info: Connecting to ftp.caser.es:22 using Sftp 3.0.4444.0.
2016-10-10 16:59:59.339 DEBUG Sftp(1)[9] SSH: Server is 'SSH-2.0-OpenSSH6.6.1'.
2016-10-10 16:59:59.342 INFO Sftp(1)[9] SSH: Negotiation started.
2016-10-10 16:59:59.372 DEBUG Sftp(1)[9] SSH: Group exchange.
2016-10-10 16:59:59.396 DEBUG Sftp(1)[9] SSH: SSH connection closed.
2016-10-10 16:59:59.420 DEBUG Sftp(1)[9] SSH: Negotiation failed: Rebex.Net.SshException: Key exchange failed. The session was closed by the remote connection end. ---> Rebex.Net.SshException: The session was closed by the remote connection end.
en Rebex.Net.SshSession.2aErfC(OCfHX )
en gbMKS.2dBnlEZ.qzm1d(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , Byte[]& )
en Rebex.Net.SshSession.qzm1d(Byte[] )
--- Fin del seguimiento de la pila de la excepción interna ---
en Rebex.Net.SshSession.qzm1d(Byte[] )
2016-10-10 16:59:59.423 ERROR Sftp(1)[9] SSH: Rebex.Net.SshException: Key exchange failed. The session was closed by the remote connection end. ---> Rebex.Net.SshException: The session was closed by the remote connection end.
en Rebex.Net.SshSession.2aErfC(OCfHX )
en gbMKS.2dBnlEZ.qzm1d(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , Byte[]& )
en Rebex.Net.SshSession.qzm1d(Byte[] )
--- Fin del seguimiento de la pila de la excepción interna ---
en Rebex.Net.SshSession.qzm1d(Byte[] )
en Rebex.Net.SshSession.14Ad4fZ()
en Rebex.Net.SshSession.Negotiate()
2016-10-10 16:59:59.426 ERROR Sftp(1)[9] Info: Rebex.Net.SshException: Key exchange failed. The session was closed by the remote connection end. ---> Rebex.Net.SshException: The session was closed by the remote connection end.
en Rebex.Net.SshSession.2aErfC(OCfHX )
en gbMKS.2dBnlEZ.qzm1d(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , Byte[]& )
en Rebex.Net.SshSession.qzm1d(Byte[] )
--- Fin del seguimiento de la pila de la excepción interna ---
en Rebex.Net.SshSession.qzm1d(Byte[] )
en Rebex.Net.SshSession.14Ad4fZ()
en Rebex.Net.SshSession.Negotiate()
en Rebex.Net.Sftp.Connect(String serverName, Int32 serverPort, SshParameters parameters)
2016-10-10 17:06:31.929 Opening log file.
2016-10-10 17:06:32.239 INFO Sftp(1)[9] Info: Connecting to ftp.caser.es:22 using Sftp 3.0.4444.0.
2016-10-10 17:06:33.420 DEBUG Sftp(1)[9] SSH: Server is 'SSH-2.0-OpenSSH
6.6.1'.
2016-10-10 17:06:33.609 INFO Sftp(1)[9] SSH: Negotiation started.
2016-10-10 17:06:34.417 DEBUG Sftp(1)[9] SSH: Group exchange.
2016-10-10 17:06:34.447 DEBUG Sftp(1)[9] SSH: SSH connection closed.
2016-10-10 17:06:34.938 DEBUG Sftp(1)[9] SSH: Negotiation failed: Rebex.Net.SshException: Key exchange failed. The session was closed by the remote connection end. ---> Rebex.Net.SshException: The session was closed by the remote connection end.
en Rebex.Net.SshSession.2aErfC(OCfHX )
en gbMKS.2dBnlEZ.qzm1d(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , Byte[]& )
en Rebex.Net.SshSession.qzm1d(Byte[] )
--- Fin del seguimiento de la pila de la excepción interna ---
en Rebex.Net.SshSession.qzm1d(Byte[] )
2016-10-10 17:06:34.941 ERROR Sftp(1)[9] SSH: Rebex.Net.SshException: Key exchange failed. The session was closed by the remote connection end. ---> Rebex.Net.SshException: The session was closed by the remote connection end.
en Rebex.Net.SshSession.2aErfC(OCfHX )
en gbMKS.2dBnlEZ.qzm1d(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , Byte[]& )
en Rebex.Net.SshSession.qzm1d(Byte[] )
--- Fin del seguimiento de la pila de la excepción interna ---
en Rebex.Net.SshSession.qzm1d(Byte[] )
en Rebex.Net.SshSession.14Ad4fZ()
en Rebex.Net.SshSession.Negotiate()
2016-10-10 17:06:34.944 ERROR Sftp(1)[9] Info: Rebex.Net.SshException: Key exchange failed. The session was closed by the remote connection end. ---> Rebex.Net.SshException: The session was closed by the remote connection end.
en Rebex.Net.SshSession.2aErfC(OCfHX )
en gbMKS.2dBnlEZ.qzm1d(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , Byte[]& )
en Rebex.Net.SshSession.qzm1d(Byte[] )
--- Fin del seguimiento de la pila de la excepción interna ---
en Rebex.Net.SshSession.qzm1d(Byte[] )
en Rebex.Net.SshSession.14Ad4fZ()
en Rebex.Net.SshSession.Negotiate()
en Rebex.Net.Sftp.Connect(String serverName, Int32 serverPort, SshParameters parameters)

Applies to: Rebex SFTP

1 Answer

0 votes
answered Oct 10, 2016 by Tomas Knopp (58,580 points)
edited Oct 10, 2016 by Lukas Pokorny

OpenSSH 6.x server is quite new, whereas your Rebex SFTP library comes from beginning of year 2012.

We have made quite some enhancements in Rebex SFTP since then. See history.

First of all, please try using the latest version of Rebex SFTP for .NET and let us know if it solves your issue then. (Try connecting with the SftpWinFormClient sample, for example.)

...