Recover ssh private key from Keychain Access

keychainpasswordssh

I have OS X 10.8.5 – I just accidentally deleted my .ssh directory. I have backups, but would prefer not to have to go through the trouble. The keys still "work" right now (they're loaded into Keychain Access and I can ssh into remote hosts) but I assume they will be lost once I log out.

I tried finding the key in Keychain Access, right-clicking on it, clicking "Copy SSH: …", but that only seems to have copied the password for that key. Is there some way to recover the private key from Keychain Access?

Best Answer

"Export "SSH key"" (or whatever the name of your key is) should be available below the copy and removal options in the right-click context menu of a key in keychain access.

Don't you see an option for export?