MacOS – How to make OS X not remember ssh key passphrase

macosssh

I have a passphrase on my ssh id_rsa key, and OS X asks me for the passphrase the first time I want to use it, but even if I decline to add it to my keychain, it doesn't ask me for a passphrase again until I reboot. How can I make it ask me for a passphrase every time I try to use it?

Best Answer

While reading GitHub documentation about adding ssh key to the ssh agent, I thought you might be able to prevent loading keys in the agent by modifying the ~/.ssh/config file like so:

Host *
 AddKeysToAgent no
 UseKeychain no
 IdentityFile ~/.ssh/id_rsa