5

Supposedly this console command will add my private SSH key to the Apple Keychain, as discussed in this Answer on the Question, How to use Mac OS X Keychain with SSH keys?:

ssh-add -K path-to-my-private-key-for-SSH

If that succeeds…

➥ What is the type and name of the entry to be found in the Keychain Access.app?

I would like to be able to manually verify and possibly delete that entry.

2

I just got a brand new laptop (running Mojave) so I had the opportunity to try this without having to sort through a large Keychain. From what I can see, running ssh-add -K path/to/key does absolutely nothing to the Keychain. No new records were created after running the command.

I'm pretty mystified as to how OSX manages ssh-agent and I can't even get it to remember my keys (Ubuntu does this by default) between sessions. I'll come back and edit if I find a solution for you.

EDIT: If you key is not passphrase protected, it looks like OSX won't add it to the Keychain. Presumably this is because the only thing the keychain stores is the passphrase. Everything else seems to require messing with the ~/.ssh/config file.

EDIT: If your ssh key is passphrase protected, running ssh-add -K path/to/key adds your passphrase to your keychain as a generic password prepended with "SSH:" Also, as for remembering keys, starting with OSX Sierra, Apple chose to stop remembering keys by default. See a brief medium article (with some external sources) here.

0

It's a little fiddly, but this works on even the latest version of Mojave (as of Darwin 18.2.0)

Prior to Mac OS 10.12.2 (Sierra is 10.12):

Edit ~/.ssh/config:

    Host *
    AddKeysToAgent yes

Mac OS 10.12.2 or greater:

Edit ~/.ssh/config:

    Host *
    UseKeychain yes
    AddKeysToAgent yes
    IdentityFile ~/.ssh/<private key filename>

You must log in to answer this question.

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