The command below hangs when I attempt to connect to SSH server from Mac OS client. However, it works perfectly fine in Linux env.
$ ssh -vvv [email protected] -p 22
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/myself/.ssh/config
debug1: /Users/myself/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving "172.18.0.2" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 172.18.0.2 [172.18.0.2] port 22.
debug1: connect to address 172.18.0.2 port 22: Operation timed out
ssh: connect to host 172.18.0.2 port 22: Operation timed out
As suggested in many posts, I've unset SSH_AUTH_SOCK
env variable but nothing has changed. The SSH server is a Docker container and ports exposed as 0.0.0.0:2222->22/tcp
at "Gateway": "172.18.0.1", "IPAddress": "172.18.0.2"
. See container's SSH and SSHD config details below if it helps.
/etc/ssh/ssh_config
Host *
HashKnownHosts yes
GSSAPIAuthentication yes
/etc/ssh/sshd_config
ChallengeResponseAuthentication no
UsePAM no
PrintMotd no
X11Forwarding no
AllowTcpForwarding no
AllowAgentForwarding no
PermitTunnel no
Subsystem sftp internal-sftp
Match Group sftp
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
AllowAgentForwarding no
PermitTunnel no
ForceCommand internal-sftp
I can confirm that the ssh-agent on client OS is running.
$ ssh-agent
SSH_AUTH_SOCK=/var/folders/gw/89swycgx0gqg8g28nfr1x2r80000gn/T//ssh-dF9lR82eJulp/agent.59018; export SSH_AUTH_SOCK;
SSH_AGENT_PID=59019; export SSH_AGENT_PID;
echo Agent pid 59019;
THIS IS VISUAL EXPLANATION OF THE PROBLEM