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 [] 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 '' 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_ACCEPT received

My MAC OS version is 10.8.2.

Does anyone have a idea ?


  • Is ssh-agent running on your machine? You can check with ps aux | grep ssh-agent – Læti Mar 11 '13 at 22:23
  • @Tonin I guess it running i.imgur.com/H5nyFHH.png . But say for information that, my ssh files directly in /etc , there is no a directory as /etc/ssh. Is there any way recovery my ssh files. – cyildirim Mar 12 '13 at 16:07

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.

  • Thanks, @Tonin. But , Is there any way restore my mac os x without loss my personal data ? – cyildirim Mar 16 '13 at 17:17
  • @cyildirim That only depends on the backup that you have. Make a backup of your data, of your personal directory, then re-install the system. – Læti Mar 18 '13 at 17:23
  • I re-installed system with backup time machine and problem fixed. – cyildirim Mar 21 '13 at 23:04

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

I think libssh2 messes up OSX default ssh install. Try:

brew uninstall --force libssh2

You must log in to answer this question.

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