0

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?

1

"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?

  • What's the type of your key line in Keychain Access? Is it listed as a 'private key', or an 'application password'? In the latter case you don't actually have the SSH key in your keychain, but just the password for it. – Arvidaa Nov 3 '13 at 22:39
  • Unfortunately, no, and I just realized why – it's not a key I'm looking at. It's the "application password" for the key file. – kojiro Nov 3 '13 at 22:39
1

Maybe you could try and see if your deleted .ssh files are still found in a hidden place inside the hard drive: /Volumes/{your_hard_disk_name}/.Trashes.

See this tutorial for how to make .Trashes readable: http://www.wikihow.com/Recover-Accidentally-Deleted-Files-in-OS-X

  • I did look there, and sadly there are no remnants of the file there. – kojiro Nov 4 '13 at 14:10

You must log in to answer this question.

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