I try to connect to my Raspberry Pi from my Mac via an ethernet cable. I get: ssh: connect to host port 22: Connection refused.

Nmap says this:

Starting Nmap 7.12 ( https://nmap.org ) at 2016-11-09 10:43 CET
Nmap scan report for
Host is up (0.00088s latency).
Not shown: 749 closed ports, 250 filtered ports
80/tcp open  http

When I connect to my Raspberry via WLAN and the Raspberry is connected to my Airport Express then connection via SSH is possible.

Nmap for this case:

Starting Nmap 7.12 ( https://nmap.org ) at 2016-11-09 10:44 CET
Nmap scan report for
Host is up (0.0015s latency).
Not shown: 995 closed ports
22/tcp   open  ssh
80/tcp   open  http
5002/tcp open  rfe
5901/tcp open  vnc-1
6001/tcp open  X11:1

I must connect to the Raspberry via ethernet cable for a show case. What do I have to change? I changed the iptable policies already but it didnt work. And I dont know which rules are used first. Additionally, I installed Eclipse Kura, tightvncserver and OpenXC framework. Since I installed those, I got the problems and entries to the iptable I don`t want to have. When I try to flush my iptables the Raspberry is operating at full capacity and unreachable.

Thanks for your help!

2 Answers 2


Connection refused means just what it says. You seem to think this has something to do with IP routing, which it does NOT - you would get a not found (or similar message) if this was so.

The most likely cause is ssh security settings on your Mac.

See Connecting a Computer to the Pi in How do I set up networking/WiFi/Static IP

  • Thanks for your answer @Milliways But I try to get a connection via link-local. Do I have to disable dhcpcd as well? Because I cannot access the Pi and you wrote in this tutorial that avahi is a zeroconf implementation...
    – KevinS
    Nov 10, 2016 at 16:29
  • @KevinS Do NOT disable dhcpcd - it is neither necessary, nor desirable. You may want to check ~/.ssh/known_hosts on your Mac. You do not state in your question HOW you are trying to connect - I assumed, because you can via LAN, that this is OK.
    – Milliways
    Nov 10, 2016 at 23:16
  • Ok. I re-read your tutorial and as stupid as it sounds but with ssh [email protected] I was able to connect ......
    – KevinS
    Nov 11, 2016 at 7:35
  • how can I access the Raspberry via VNC? A tightvncserver is already running but I get a timeout when I try to access raspberrypi.local:1 with VNCViewer. When I try to get the IP address, I have the one from my Mac preferences: and when I use ifconfig on the Raspberry I get a IPv6 address which I cannot connect to.... @Milliways I´m so sorry but Im a newbie with Raspberry Pis and cant get it to run like I want it...
    – KevinS
    Nov 12, 2016 at 11:13
  • @KevinS try open vnc://[email protected]:5901 I am not sure if this works - I rarely use vnc. I know rsync doesn't work this way.
    – Milliways
    Nov 12, 2016 at 21:45

I enabled ssh on my pi using sudo raspi-config and then followed this: https://mycyberuniverse.com/mac-os/connect-to-raspberry-pi-from-a-mac-using-ethernet.html

Worked a charm.

Your Answer

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

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