macOS Keeps Asking for SSH Passphrase

Published by Christian Mohn · Read in about 1 min (157 words)

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.

Info

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!

Post last updated on January 2, 2024: Add author

About

vNinja.net is the online hub of Christian Mohn and Stine Elise Larsen.

The site primarily focuses on IT architecture and data center technologies, with a strong emphasis on virtualization and related topics.
While the main content revolves around these areas, you'll also find a range of other subjects covered from time to time, reflecting the interests of authors.

Sponsors