OS X Keeps prompting me for SSH private key passphrase (OS X 10.6.8)

Posted by Danny Englander on Server Fault See other posts from Server Fault or by Danny Englander
Published on 2012-08-28T00:52:38Z Indexed on 2012/08/28 15:41 UTC
Read the original article Hit count: 356

Filed under:
|
|
|

I have a private key to ssh into my server and the connection works. In my hosts file I have:

Host myhost
    HostName xxx.xxx.xxx.xx
    GlobalKnownHostsFile ~/.ssh/known_hosts
    port 22
    User myuser
    IdentityFile ~/.ssh/mykey_dsa
    IdentitiesOnly yes

.. and then I type ssh myhost

Every time I connect, I get the Mac OS X keychain prompt and I tell OS X to remember the passphrase but then when I disconnect from ssh and re-connect, I am prompted to add the passphrase to the keychain again. This is only a recent problem so I suspect and issue with Keychain? To be clear, I can 're-add' to keychain every time and connect but this defats the purpose. The permissions on my dsa key are set at 600 or -rw-------@

I tried repairing disk permissions but that did no good. My Google-foo is also failing me, nothing of use came up. So I am not sure if this an OS X / keychain issue or an SSH issue.

update: When I try ssh -vvv myhost, I think it reveals the issue:

debug1: Trying private key: /Users/danny/.ssh/mykey_dsa
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
debug3: Not a RSA1 key file /Users/danny/.ssh/mykey_dsa.
debug1: read PEM private key done: type DSA
Identity added: /Users/danny/.ssh/mykey_dsa (/Users/danny/.ssh/mykey_dsa)
debug1: read PEM private key done: type DSA
debug3: sign_and_send_pubkey
debug2: we sent a publickey packet, wait for reply
debug1: Authentication succeeded (publickey).

... and after that I get connected. I think this crux of the matter is:

PEM_read_PrivateKey failed

© Server Fault or respective owner

Related posts about ssh

Related posts about macosx