SSH/SFTP connections fails silently on OSX 10.8.2 - ssh-agent issue

Solution 1:

Reason of the silent failing when connecting

Your system.log errors show you have an issue with your ssh-agent running locally on your iMac. For some reason it doesn't run even if launchd tries to restart it.

When you try to connect using any ssh client (CLI or Transmit) they try to use ssh-agent but they cannot connect to it as it's not running. Hence their waiting without output nor input.

I'm not sure what prevents your ssh-agent from running. However, to run your ssh client on the CLI and make it connect to your servers, you can try the following:

unset SSH_AUTH_SOCK
ssh [email protected]
# (you'll then be asked for you pass phrase if you use one)

You can even try to launch Transmit from the same Terminal window:

open /Applications/Transmit.app

About ssh-agent debugging

If ssh-agent -l tells you the -l option is illegal, it means it's not the original Apple ssh-agent that your system is trying to run (-l is an Apple undocumented feature). The replacing ssh-agent is making launchd unhappy. This blog post might have some explanations why.

If you have third party ssh tools (coming from brew, macports or other channels), I'd recommend you move them out of the way or you upgrade them (provided they are launchd capable, i.e.: the -l option exists). A working ssh-agent invocation should answer something like:

antoine@amarante:~$ /usr/bin/ssh-agent -l
launch_msg: Operation not permitted

It is also a good idea to check you don't start ssh-agent from other places like .bashrc or other session startup scripts. Having multiple, and possibly different, ssh-agent running at the same time is potentially a source of problem.

Solution 2:

Would you please to check SSH connection with other program like Cyberduck?

Also I've found solution where you need to check launch agents at following locations:

/Macintosh HD/Library/LaunchAgents/
/Macintosh HD/Library/LaunchDaemons/
/username/Library/LaunchAgents/
/username/Library/LaunchDaemons/

and then check missing executables or files without executable flag toggled.

Mine OpenSSH local version is OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011

So you can also try OpenSSH from macports or brew. I personally prefer macports then brew if I need anything not in OS X by default.

UPDATE:

  1. Try to run ssh -a [email protected], same as above but with disabled agent forwarding
  2. check if your Keychain Access keys are correct
  3. check if your directory ~/.ssh has correct permissions (0600)
  4. check if your keys are correct.
  5. try to run "source `ssh-agent`" before executing ssh command

UPDATE2:

On my system (OS X 10.8) org.openbsd.ssh-agent.plist looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>org.openbsd.ssh-agent</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/ssh-agent</string>
        <string>-l</string>
    </array>
    <key>ServiceIPC</key>
    <true/>
    <key>Sockets</key>
    <dict>
        <key>Listeners</key>
    <dict>
            <key>SecureSocketWithKey</key>
            <string>SSH_AUTH_SOCK</string>
        </dict>
    </dict>
        <key>EnableTransactions</key>
        <true/>
</dict>
</plist>

Also I ses this:

$ /usr/bin/ssh-agent -l
launch_msg: Operation not permitted
$ shasum -a 256 /usr/bin/ssh-agent 
e21e2f23819b60f6288edda97427d98413c1bb737d49d313e2857f058627aab6  /usr/bin/ssh-agent