Why can't I ssh using a port other than 22 with macOS 10.15.4?
I'm trying to ssh to a machine that opens the port 8012 for ssh as opposed to port 22. When I ssh at the command line (ssh -p 8012 username@host
), nothing happens. The -vvv
option gives no pertinent information other than "trying to connect".
I can do ssh ssh://[email protected]
(on standard port 22) without problems.
Further, on this Mac I have a VM running Debian. Within this VM I can ssh on the machine with the non-standard port 8012 without problems.
I also have a separate Windows machine where I also have no problems doing what I described.
Edit: output of ssh -vvv ...
:
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/[username]/.ssh/config
debug1: /Users/[username]/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to [destination] port 8012.
And then it gets stuck there.
Output of cat ~/.ssh/config
:
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
Uncommented lines of the output of cat /etc/ssh/ssh_config
:
Host *
SendEnv LANG LC_*
It appears my issue is specifically tied to a recent update of MacOS. The answer was found here: https://mjtsai.com/blog/2020/03/31/macos-10-15-4-broke-ssh/. Specifying the IP address of the server rather than its name resolved my issue.