Ssh suddenly stopped working on Mac

mac-osxnetworkingssh

Everyday I wake up and check the my servers are running smooth, I use my mac to connect to some ubuntu and some freebsd machines.

But today when I tried something strange happened:

$ ssh -v -p 41900 someserver.com
OpenSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to someserver.com [95.166.12.75] port 41900.
debug1: Connection established.
debug1: identity file /Users/someuser/.ssh/identity type -1
debug1: identity file /Users/someuser/.ssh/id_rsa type -1
debug1: identity file /Users/someuser/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8p2_hpn13v11 FreeBSD-20110503
debug1: match: OpenSSH_5.8p2_hpn13v11 FreeBSD-20110503 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '[someserver.com]:41900' is known and matches the RSA host key.
debug1: Found key in /Users/someuser/.ssh/known_hosts:3
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/someuser/.ssh/id_dsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /Users/someuser/.ssh/identity
debug1: Trying private key: /Users/someuser/.ssh/id_rsa
debug1: Next authentication method: keyboard-interactive
Password:
debug1: Authentication succeeded (keyboard-interactive).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.

Now the connection just hangs, nothing happenes — until it timesout and shuts down after some minutes.

[UPDATE]

After having tried putting my laptop into a bag and going to another network, I have come to beleave that this is a network issue, and my instincts were confirmed when I found out that my ISP had gone bankrupt.

However, this raises a new question, becaurse I tried loggin onto another network using vpn, but the same issue accured, can anyone explain how a routing problem on one network can affect a vpn connection — that is othervise running fine?

Can anyone tell me what happened to my ssh client? And perhaps even how I fix it?

Best Answer

This is more likely to be a server issue than a client issue. The connection has been made and authenticated and the client is now waiting for the server to start the session (which I think means forking an sshd process for the user and starting the user's shell). This can be caused by the server being under some kind of load (such as memory and disk IO).

Check that the other services the server is providing are operational -- this could confirm problems on the server. Also try connecting from another network location to rule out weird network issues.

Edit: So this is a client networking issue. Most of the problems where I've seen connections work initially but then hang later on have been caused by MTU problems -- the initial packets (the SSH negotiation in this case) are small enough to pass through, but when actual data gets sent (like drawing a terminal window) the packets are too big and get dropped somewhere. Try decreasing the MTU on your client and trying again.