SSH connection hangs out at SSH2_MSG_SERVICE_ACCEPT recieved

I tried to connect to a server with ssh, but it failed. I tried UseDNS no, update OpenSSH with MacPorts. But it didn't work.

Using user@ip -v I get the following output

OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to 50.63.25.99 [50.63.25.99] port 22.
debug1: Connection established.
debug1: identity file /Users/can/.ssh/id_rsa type -1
debug1: identity file /Users/can/.ssh/id_rsa-cert type -1
debug1: identity file /Users/can/.ssh/id_dsa type -1
debug1: identity file /Users/can/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH_4*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9
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: Server host key: RSA 46:ef:da:91:a3:6d:60:54:ed:cf:d2:87:b2:85:b4:1d
debug1: Host '50.63.25.99' is known and matches the RSA host key.
debug1: Found key in /Users/can/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received

My MAC OS version is 10.8.2.

Does anyone have a idea ?

Thanks.


Solution 1:

From the log trace and from your screenshot one can see that ssh-agent is not running. That is what is causing your ssh session to hang and not respond.

There might be multiple reasons for your ssh-agent not running, including misconfiguration or conflict between different versions of ssh binaries installed (Apple original one, macports or brew installed). The best and easier, unless you're sure what you're doing and you have a reason to do it, is to stick with Apple's original.

Try to revert to a backup installation or re-install OSX properly.

This other question on ServerFault (and my answer) may help you further.

Solution 2:

You can try to delete the known_hosts files in ~/Library/.ssh.

But first, you need to display all hidden files on your Mac.

How to display all hidden files on your Mac: open Terminal:

defaults write com.apple.finder AppleShowAllFiles TRUE;killall Finder

At the end follow this command to hidden all hidden files on you Mac:

defaults write com.apple.finder AppleShowAllFiles FALSE;killall Finder