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?
2 Answers
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
Execute following command in Termina.app will disable Keychain integration, thus ssh will always ask you for a passphrase:
defaults write org.openbsd.openssh KeychainIntegration -bool false
Pleases note:
- This is undocumented, but as far as I know, it works from macOS 10.6 (Snow Leopard) to 10.11 (El Capitan)
- It will affect all private keys, not just
id_rsa
- Set the value to
true
if you want to recover the default behavior - Kill
ssh-agent
process or restart your Mac if it has no effect after executing the command
-
its still remembering the passphrase unfortunately, even after doing this. I'm on Sierra now but it was still happening even with El Capitan... Sep 29, 2016 at 14:34
-
@MohamedHafez Maybe go into the Keychain app and delete the entry? (just search for ssh)– FabSep 28, 2018 at 16:12
ssh-add -l
prints after the first use? And what aboutecho $SSH_AUTH_SOCK
?