I'm working with two embedded boards on my Linux machine. For one of them, I am able to connect to it through ssh on port 22 with no problems. But when I try to connect to another one on port 22, it gives me

Connect to host port 22: connection refused

It's very weird because I am able to connect to one board but not the other. And since I'm able to connect to one, I know there are no problems with ssh, or any firewall or iptables problems.

Does anyone know through this little information what might be the problem?

For further information, I am nevertheless able to ping to the device which is refusing the connection.

  • have a look in your ~/.ssh/known_hosts, maybe you need to manually remove a older key for the address... – Gotschi Apr 23 '14 at 13:18
  • @Gotschi I've removed the whole file (as some solutions suggested) so it shouldn't be a problem. – Adam Apr 23 '14 at 13:19

"Connection refused" means that there is no process listening for connections on that port. Port 22 is the SSH server port. So, the the computer which is returning the "connection refused" error probably isn't running an SSH server. Or, if it is running an SSH server, the server has been set to accept connections on a different port.

| improve this answer | |
  • Thank you for your answer. How can I change its listening port then? It's an embedded board and since I'm not able to connect to it, is there a way I can change which port it listens to? And how do I make sure it's running ssh? Again, this is an embedded board not a computer. – Adam Apr 23 '14 at 13:21
  • I also forgot to mention that I can ping to each of the devices, but can't connect to one of them. – Adam Apr 23 '14 at 13:26
  • Your best bet is to ask a new question specifically about how to check/adjust the SSH server in your embedded computer. Be sure to mention what kind of device it is, what OS it's running, how you are able to access it (without working SSH), and information along those lines. – Kenster Apr 23 '14 at 13:35
  • I guess you're right. Do you have any advice/help that may put me along those lines before I ask a new question? – Adam Apr 23 '14 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.