I’m a big fant 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.
~/.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!