This project is read-only.

SshException Thrown When Connecting

Feb 22, 2011 at 12:11 AM

I just came across this today and was excited to see a current/supported project for SSH in .Net.  Unfortunetely, I am getting an error when I'm trying to connect to a server.  Its throwing a "Message type 2 is not valid." exception during when I call the Connect method.  I've confirmed I can SSH to the server using plink, so I know SSH is functioning.  I'm guessing there is something wrong with the key exchange, but thats just my guess at this point.

Here is the code I'm using to connect.

Dim SSHConnect As Renci.SshClient.SshClient
Dim connInfo As Renci.SshClient.ConnectionInfo
connInfo = New Renci.SshClient.PasswordConnectionInfo(txtHost.Text, txtUsername.Text, txtPassword.Text)

SSHConnect = New Renci.SshClient.SshClient(connInfo)

Any help with this would be appreciated.

Feb 22, 2011 at 12:29 AM



Thanks for pointing out this issue.

What happens is for some reason my client cannot handle IGNORE message.


Can you tell me what scenario are you using, SSH terminal, SFTP or port forwarding?

Also, did you try to connect to other SSH server to see if it would work?

If its possible, can you turn logging on when you connect using putty and send it to me, if its not a security risk there of course?

Do you you use source or binary version, if you using source can you let me know what line exact it failing?

Also, do you happened to know what authentication methods suported by the server? password, private-key etc'.

And las question, what server version you trying to connect to?




Feb 22, 2011 at 1:40 AM

OK, I think I have all of the information you were looking for.

Usage Scenario: SSH terminal

Connect to other SSH server: failed with same error

Logging: sent

Version Used: Both.  I first got the error with the binary, went to source to try and track down the error.  Fail in the Session class on the WaitHandle method on this line:
     var index = EventWaitHandle.WaitAny(waitHandles);
index is getting set to 0

Authentication Methods: password, private-key (attempting password)

SSH Version: 2.0

Feb 22, 2011 at 3:21 PM


I identified the issue but cannot test it with my servers.


Can you please download latest code (6616) and let me know it works for you?




Feb 22, 2011 at 4:11 PM

That did the trick, thanks for getting back so fast with a fix.  Now to figure out how to implement this into my application :)