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.'
2
  • 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. Commented Dec 19, 2018 at 16:25
  • When i connect with my raspberry from linux, i use sudo ssh [email protected] -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. Commented Dec 20, 2018 at 12:00

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.