Connection refused using ssh on 10.15.4

I recently got a new iMac running OSX 10.15.4 and got “Connection refused” errors on both Apple’s sshd and on Homebrew’s. I use ssh to connect to my machine remotely. Before I got my new machine I was using 10.15.2 with no problems.

The following is a sample of trying to connect to my local machine from Terminal:
harry@gull ~ % ssh -vvv 192.168.0.9
OpenSSH_8.2p1, OpenSSL 1.1.1g 21 Apr 2020
debug1: Reading configuration data /Users/harry/.ssh/config
debug1: Reading configuration data /usr/local/etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname 192.168.0.9 is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.0.9 [192.168.0.9] port 22.
debug1: connect to address 192.168.0.9 port 22: Connection refused
ssh: connect to host 192.168.0.9 port 22: Connection refused

Interestingly, attempting to connect to 127.0.0.1 succeeds.

Does anyone have any ideas?

If both macOS and homebrew’s version don’t work I doubt it’s a homebrew issue. Did you try scanning if the port is open using nmap?

I agree it’s probably not a homebrew issue, since sshd was working before I upgraded to 10.15.4. Just hoping someone had found a fix.

I have done a scan using nmap and the results are as one would expect:

xxx@yyyy ~ % nmap -p 22 192.168.0.9
Starting Nmap 7.80 ( https://nmap.org ) at 2020-05-15 08:22 PDT
Nmap scan report for yyyy (192.168.0.9)
Host is up (0.038s latency).

PORT STATE SERVICE
22/tcp closed ssh

Nmap done: 1 IP address (1 host up) scanned in 0.08 seconds

Are you sure that the service was restarted after the update?

OSX thinks so:

xxx@yyy ~ % sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
/System/Library/LaunchDaemons/ssh.plist: service already loaded
xxx@yyy ~ % nmap -p 22 192.168.0.9
Starting Nmap 7.80 ( https://nmap.org ) at 2020-05-16 08:03 PDT
Nmap scan report for yyy(192.168.0.9)
Host is up (0.035s latency).

PORT STATE SERVICE
22/tcp closed ssh

Nmap done: 1 IP address (1 host up) scanned in 0.11 seconds
xxx@yyy ~ % ssh 192.168.0.9
ssh: connect to host 192.168.0.9 port 22: Connection refused

Sorry for this thread. Some other box on my lan had grabbed my iMac’s DHCP address. I finally noticed that System Preferences -> Sharing -> Remote Login had a strange IP address for the display “To log in to this computer remotely, type ssh xxxx@strangeIPaddress”

I fixed the problem and all is now well. Note: There are still lots of pages on Google regarding OSX 10.15.4 killing ssh.