So, as the title states, I cannot SSH to a Raspberry Pi from my Mac. I have done so in the past, but can't figure out why it won't work now.
Unless stated otherwise, all devices I mention below are hardwired to the same network.
This problem has come up a couple of times over the years, but it was always related to the known_hosts file on the Mac--I could delete the Pi's entry out of that file and then it would work again.
I get the dreaded Port 22: Connection Refused
error. After scouring forms and trying many of the suggestions, I have had no luck. None of the problems really are the same as mine (I think all of them have been about setting up new Pi's or the Mac being the outright new variable on the network), but I thought I'd go about their troubleshooting. It seems that this is a catch-all error that has many solutions, but many more problems...
The Pi has Port 22 open and is listening to it. I can connect to it via other methods.
I can get around the problem:
- I can SSH to a different Raspberry Pi on the network and then SSH to the Pi in question.
- I can SSH to the Pi in question through Power Shell on a Windows computer I have.
- I can SSH to the Pi through a terminal program on an iPhone and an iPad.
- I can SSH to the Pi remotely from other devices outside of my network via port forwarding I have set up on my router.
- I can Ping the Pi from the Mac
- I can VNC to the Pi from the Mac.
- I can SSH to the Pi in question from another device (the Pi's on my network are all headless) and then SSH to the Mac.
- And, if I'm a little bored, I can SSH from my Mac to the other Pi, SSH to school, SSH to a family member's computer in another state, and then finally SSH back to the Pi that my Mac can't connect to.
So this has been going on for a long time now and the absurdity of the work arounds finally hit me. I am tired of the work around.
Any ideas what is happening? Why is the connection being refused between only these two devices?
ssh -vvv ....
?sshd
is not running on the pi, or is using an alternate port. There's not much information beyond that anyone can offer, unfortunately.OpenSSH_8.1p1, LibreSSL 2.7.3 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 47: Applying options for * debug2: resolve_addr: could not resolve name .... as address: nodename nor servname provided, or not known debug1: resolve_canonicalize: hostname .... is an unrecognised address debug1: Connecting to .... port 22. ssh: Could not resolve hostname ....: -65540