I'm migrating to a new Macbook. On my old one, I generated an ssh key pair many years ago, and I have configured that key on several sites, some of which I don't have direct control over. After I set up my keypair, I used ssh-add to import the cert into my keychain so I wouldn't have to type the passphrase every time. This worked fine.

Now that I am migrating to a new Mac, I am trying to import my id_rsa key on my new mac, but it's asking me for a passphrase that I apparently do not remember. I feel like that passphrase must be stored in the keychain of my old mac (which I still have), but I haven't figured out which of the entries in my old keychain is my id_rsa cert (we use S/MIME encrypted e-mail at work and the cert expire frequently, so I have quite a few certs in there).

So -- is there a way for me to either view the passphrase of my id_rsa cert in Keychain Access (after I unlock it with my system password), or to export my keypair from Keychain access in such a way that I can import it on my new Mac without having the original passphrase?

Thanks!

There was a similar question on SuperUser here on SE.

If you have still have access to your old Mac and you can successfully login into whatever services require your id_rsa cert with your passphrase saved in Keychain, you should be able to get the passphrase with no problem.

Basically, you should be able to see the passwords by selecting Show Password in Keychain.

Have a look at this answer for details

  • Thanks. I have tried to do this, but I can't seem to find which of the many certs in my Keychain is actually the id_rsa cert. If I look in the login keychain in the My Certificates category, there are 35 certs. Of these, about 20 appear to have been generated by Microsoft Lync, another 10 generated by the Mac (com.apple.ubiquity...) and all of those are expired anyway. Of the remaining certs there are only a few that are not expired, and none of them appear to be my id_rsa cert (I'm looking at Get Info and comparing the public key listed there with the public key I see in the id_rsa key file.) – jptsetme Apr 13 '16 at 17:55
  • But if you use the old mac, it remembers the passphrase when you try to connect to whichever service requires it? – Allan Apr 13 '16 at 18:02
  • Try looking in your other keychains. There is, by default, at least a system and a login one. Try them both. – Crystalclaw Apr 13 '16 at 19:51
  • @Allan - correct. Either it remembers the passphrase and uses it or it directly stored the private key in the keychain rather than storing the passphrase and pointing to the id_rsa file. I can connect to servers without using a passphrase on the old mac. – jptsetme Apr 14 '16 at 18:49
  • @Crystalclaw, I have looked, but it's painstaking and I'm not sure if my manual search criteria is correct. i.e. I have the public key from my id_rsa.pub, and I am looking at Get Info properties of each cert from each keychain, scrolling down to see the start of the public key and looking for a match. I have not been successful yet. If anyone who has a similat config is able to tell me how the cert appears in their keychain to aid my search, I'd be grateful. – jptsetme Apr 14 '16 at 18:51

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.