Skip to main content
  1. posts/

macOS Keeps Asking for SSH Passphrase

·156 words·1 min·
Author
Christian Mohn
IT veteran, podcaster, author, and blogger from Bergen, Norway.

I’m a big fan of Public Key authentication for SSH but I recently ran into an issue after adding my Public Key to a couple of new Linux VMs I use. The problem was that macOS kept asking for the SSH passphrase when connecting to them, which kind of defeats the purpose of using Public Key authentication in the first place.

Thankfully, the solution is pretty simple.

in ~/.ssh/config add the following to the end of the file, to allow usage of the Apple Keychain for SSH:

Host *
  UseKeychain yes

This simply allows the usage of the stored Public Key passphrase in the Keychain for all hosts.

Note: You can specify this setting for specific hosts too if you want to, by replacing the asterix with the hostname and/or IP address for the host.

Apparently this was a change done in macOS Sierra, and I don’t know why I haven’t come across it before now!

Related

macOS: Secure Pipes
macOS: Using Custom DNS Resolvers
·272 words·2 mins
macOS: Using and creating Multi-Output Sound Devices
·419 words·2 mins