2

I tried a lot of things to figure out why my SSH gives me the following message (I am using IP and I took out the IP address)

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 *
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxxxxx] port 22.
debug1: connect to address xxx.xxx.xxx.xxx port 22: Operation timed out

I can connect to my VM (on the same machine), a server in my intranet (even inside VPN) without any issues.

But, every time I connect to a server on the internet. I got above message.

NOTE:

  • The internet server is working. I use another laptop SSH to the internet server (in the same network). It is working fine.
  • I do not have any firewall in my Macbook Pro.

Update1: My /etc/ssh/ssh_config has the following settings. (I did not list comments.)

Host *
    SendEnv LANG LC_*

Update2: After use telnet xxx.xxx.xxx.xxx 22

My failed macbook showed the following:

Trying xxx.xxx.xxx.xxx...
telnet: connect to address xxx.xxx.xxx.xxx: Operation timed out
telnet: Unable to connect to remote host

And my working macbook showed

H-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2

Update3: I did two things. (1) I upgraded to Monterey 12.2. The same issue still occurred. (2) I troubleshoot by executing the following commands. I get responses as follows.

telnet xxx.xxx.xxx.xxx 22
Trying xxx.xxx.xxx.xxx...

Then

telnet xxx.xxx.xxx.xxx 23 
Trying xxx.xxx.xxx.xxx...
telnet: connect to address xxx.xxx.xxx.xxx: Connection refused
telnet: Unable to connect to remote host 
ssh -vvv [email protected] -p 200
OpenSSH_8.6p1, LibreSSL 2.8.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug2: resolve_canonicalize: hostname xxx.xxx.xxx.xxx is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/Users/hchang/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/Users/hchang/.ssh/known_hosts2'
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug3: ssh_connect_direct: entering
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 200.
debug3: set_sock_tos: set socket 3 IP_TOS 0x48
debug1: connect to address xxx.xxx.xxx.xxx port 200: Connection refused
ssh: connect to host xxx.xxx.xxx.xxx port 200: Connection refused

I strongly think the port 22 is limited by newer MacOS. I also saw similar complaints from some post. I need to figure out how MacOS is doing on it.

Update4: I got findings as follows.

https://itectec.com/askdifferent/ssh-not-working-after-macos-10-15-6-update/ https://tyler.io/so-uh-i-think-catalina-10154-broke-ssh/

So, I switched my hosting server to listen to port 8822 and then use my failed Macbook to SSH it. It worked on the port 8822.

To summarize my experiences so far - (1) Changing port from 22 to others working fine. (2) Using port 22 to SSH to "intranet" host working fine. (3) It seemed happening in newer MacOS

6
  • Is there something "special" in /etc/ssh/ssh_config or is the version installed by macOS? Do you see a log entry on the remote side? If you run telnet remote-host.com 22, do you get a response from the remote server (something like SSH-2.0-OpenSSH_7.9 FreeBSD-20200214)?
    – nohillside
    Commented Feb 5, 2022 at 16:01
  • @nohillside I update my question according to your suggestions. Commented Feb 5, 2022 at 16:19
  • Can you at least ping the remote server?
    – nohillside
    Commented Feb 5, 2022 at 16:23
  • Also, did you check the IP adresses, are they correct (the same as shown on the Mac which can connect)?
    – nohillside
    Commented Feb 5, 2022 at 16:24
  • Ping from the failed machine is okay. Commented Feb 5, 2022 at 16:24

1 Answer 1

1

I answered what I found from MacOS SSH. The only fix to me is to use Homebrew to install a new SSH client and do not use the default MacOS SSH client.

The drawback from some other online posts is not able to use MacOS Keychain. I do not really care about that.

A similar post is here - https://developer.apple.com/forums/thread/698683

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .