Tuesday, 3 January 2017

Mac OSX keeps prompting for SSH key passphrase

So, since I upgraded my MAC to OSX 10.12.2 I always get promted for my SSH key passphrase witch is rather annoying.
$ ssh example.com
Enter passphrase for key '/Users/thorst/.ssh/id_rsa':
This passphrase was stored in Keychain and was unlocked when I unlock my MAC
By adding UseKeychain yes to your ~/.ssh/config it solves this problem.
$ cat ~/.ssh/config
Host *
  UseKeychain yes
In courtesy of  @aral on Twitter.
You can also read more about Keychain changes in Technical Note TN2449
Keychain changes
Prior to macOS Sierra, ssh would present a dialog asking for your passphrase and would offer the option to store it into the keychain. This UI was deprecated some time ago and has been removed.
Instead, a new UseKeychain option was introduced in macOS Sierra allowing users to specify whether they would like for the passphrase to be stored in the keychain. This option was enabled by default on macOS Sierra, which caused all passphrases to be stored in the keychain