This project is read-only.

Causes of "Server response does not contain SSH protocol identification"

May 22, 2015 at 7:43 PM

Does anyone ever ran into the "Server response does not contain SSH protocol identification" error?

What can cause that?

I'm using the library in a website to transfer file to another server using sftp. When testing the website from my workstation, everything works. But when I deploy on the dev server (or production) I get that error.

Firewall port is open (I was first getting a firewall error before the port was open)

Anyone got an idea about that error?

Apr 15, 2016 at 5:17 PM
I am getting that same error "Server response does not contain SSH protocol identification".
My program sends a file, and pulls a file at certain times (sends a file at 3 a.m., pulls a file at 8 a.m.)

What is puzzling is that the error seems to happen randomly.
Also, when I attempt to re-run the program to send file that failed before, it then works.
Similarly, sometimes the pulling of the file fails, and I re-attempt, then it works.
Sometimes, when I re-attempt it fails, the later the automated program runs, and it works.

What could be causing this apparent random error????
Apr 15, 2016 at 5:27 PM
I forgot to add some information of exactly what piece of code I am using.

my log shows "Connecting..", then I see the exception "Exception caught in BBGenDataApplication.Utils.uploadFile: Server response does not contain SSH protocol identification."
so it could be the connect fails, or it connected, and the ChangeDirectory() fails..
I'll have to put a debug line right after the connect.
Still, the problem is, why it sometimes fails, and sometimes it doesn't?
and in re-attempt, the same file transmission works most of the time.

The program fails right after
    public static void uploadFile(String uploadLongFileName)

            // FTP_SERVER, FTP_USER, FTP_PASSWORD are set previously 

            // upload a file
            using (var sftp = new SftpClient(FTP_SERVER, FTP_USER, FTP_PASSWORD))


                Utils.doLog("moved to dir...");

                // upload the file 
                using (var filestream = File.OpenRead(uploadLongFileName))
                    // upload the file, cannot override (should not need it)
                    sftp.UploadFile(filestream, uploadShortFilename, false);
                    Utils.doLog("uploaded file...");

        catch (Exception ex)
            errMessage = "Exception caught in " + methodName + ": " + ex.Message;
Jun 22, 2016 at 4:55 AM
Hi Philippe,

What version of SSH.NET are you using ?
Would it possible to try the recently release 2016.0.0-beta1 ?
What SSH server (and which version) are you using ?

Jun 27, 2016 at 9:58 PM

Sorry I was out of the office.

I downloaded the source code. Where can I see the release #?

Jun 28, 2016 at 6:21 PM
Edited Jun 28, 2016 at 6:22 PM
Where did you download the sources code from ?
Can't you just use the 2016.0.0-beta1 or 2016.0.0-beta2 nuget packages ?
Jun 28, 2016 at 6:25 PM

Thank you for responding.

Following the instructions to get the latest source code, shown below, I clicked on source code, download..

Which took me to this download: