2

I try to connect with raspberry pi by ssh, but unfortunately i have this error message. I try to use try-catch like in this topic,Renci.SshNet : "server response does not contain ssh protocol identification" But it not help. When i try to connect with this device by ssh.client on linux, everythink work, so IP and port are well. I work on Visual studio and i use Xamarin.forms.

My code:

using (var client = new SshClient("11.15.16.385", 24, "root", "password"))
{
    client.Connect();
    client.RunCommand("reboot");
    client.Disconnect();
}

Results in:

Error in client.connect():

Renci.SshNet.Common.SshConnectionException: 'Server response does not
contain SSH protocol identification.'
jww
  • 97,681
  • 90
  • 411
  • 885
Cierniostwor
  • 339
  • 2
  • 4
  • 15
  • 1
    Port 24 isn't the normal SSH port. Are you sure that's the port you want to connect to? It would be helpful to see what if any text you're receiving from the server when you connect to it. You could collect this information by connecting to the port with the `nc` or `telnet` utilities, or by running `ssh` with the -v option to print debugging information. – Kenster Dec 19 '18 at 16:25
  • When i connect with my raspberry from linux, i use sudo ssh root@11.15.16.385 -v, and i can see a debugging information, this is a good way. Do you know how to use this "-v" in C # in "SshClient"? BTW. when i run "ps aux" on raspberry and see process "sshd: [accepted]", so my windows do connect with raspberry, but something is going wrong. – Cierniostwor Dec 20 '18 at 12:00

1 Answers1

1

This is probably caused by the response sent by your raspberry pi as you can see from the see from the source code. It might be missing version information.