2
Vote

Server response does not contain SSH protocol identification

description

Getting an error Renci.SshNet.Common.SshConnectionException: Server response does not contain SSH protocol identification. at Renci.SshNet.Session.Connect() at Renci.SshNet.BaseClient.Connect() when SFTP server was configured not to return server version.

Would be nice if there was a way to disable version check, possibly configurable?

comments

ceciliaschultz wrote Dec 7, 2016 at 3:52 PM

I have s similar problem.
My application uses Renci.SShNet.dll to ftp a file nightly. Approximately every 3 weeks it fails with the error "Server response does not contain SSH protocol identification", which is where the library is attempting to do a socket read of the version:

public void Connect()
{
//.......
                //  Get server version from the server,
                //  ignore text lines which are sent before if any
                while (true)
                {
                    var serverVersion = string.Empty;
                    SocketReadLine(ref serverVersion, ConnectionInfo.Timeout);
                    if (serverVersion == null)
                        throw new SshConnectionException("Server response does not contain SSH protocol identification.");
                    versionMatch = ServerVersionRe.Match(serverVersion);
                    if (versionMatch.Success)
                    {
                        ServerVersion = serverVersion;
                        break;
                    }
                }
//....
}


So when it fails, I have to manually run it the following morning, (with no problems). Then the job continues fine for abut 3 weeks, then it fails again, and so on...

I cannot imagine why it would fail every so often... and then it works fine without doing anything....

wrote Dec 19, 2016 at 9:12 AM