

It prompts for the passphrase and adds it to the keychain.

Have been renamed -apple-load-keychain and -apple-use-keychain The -A and -K options used in earlier macOS releases. From the ssh man page:Įnables or disables the older processing of Note that these option flags have been renamed and the old ones deprecated in later versions of macOS. No passphrase typing required.Īlso, in macOS Sierra and High Sierra (don't know about previous versions), running ssh-add -A will get the agent to load all keys whose passphrases are stored on Keychain. That's it! Next time you load any ssh connection, it will try the private keys you've specified, and it will look for their passphrase in the OSX keychain. The UseKeychain yes is the key part, which tells SSH to look in your OSX keychain for the key passphrase. For example, I have one additional line that reads IdentityFile ~/.ssh/id_ed25519 for a 2nd private key. If you have other private keys in your ~/.ssh directory, also add an IdentityFile line for each of them. ssh/config file, add the following lines: Host *Ĭhange ~/.ssh/id_rsa to the actual filename of your private key. ssh directory in your home dir, make a file called config. If you haven't already, create an ~/.ssh/config file. Here's what you do:Įnsure you've completed Step 1 above to store the passphrase in the keychain. The solution is outlined in this github thread comment. Because of this, you need to change one more thing for secure persistent key storage.
Mac keychain access show password rsa update#
It seems that OSX Sierra removed the convenient behavior of persisting your keys between logins, and the update to ssh no longer uses the keychain by default. (Note: In versions of OSX prior to Sierra, this is not necessary) check with which ssh-add) Step 2 - Configure SSH-agent to always use the Keychain (If this fails, make sure you are using Apple's version of /usr/bin/ssh-add and not something installed with brew etc. Or in versions of MacOS older than 12.0 Monterey, use: ssh-add -K ~/.ssh/Įnter your key passphrase, and you won't be asked for it again. In the latest version of MacOS (12.0 Monterey), just do this once: ssh-add -apple-use-keychain ~/.ssh/

Step 1 - Store passphrase in the Keychain On OSX Sierra and later, you also need to configure SSH to always use the Keychain (see Step 2 below).Īlternatively you can use a key without a passphrase, but if you prefer the security that's certainly acceptable with this workflow. On OSX, the native ssh-add command has a special argument to save the private key's passphrase in the OSX Keychain, which means that your normal login will unlock it for use with ssh. It is not possible to add private key to Keychain, but you can store passphrase for private key in Keychain.
