Server response does not contain SSH protocol identification


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?


ceciliaschultz wrote Dec 7, 2016 at 4: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;

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 10:12 AM