10

How do I turn the SSH Agent off? I'm having troubles with Vagrant and it indicates that I should disable my SSH Agent before continuing, yet I can't find a straight forward answer. How would I do it?

Temporary answers work too. I'm happy with how my environment is setup, it's just this particular situation where I need to verify that disabling the SSH Agent corrects the issue, even if I then turn it back on.

3 Answers 3

10

unset the environment variable $SSH_AUTH_SOCK. In bash, from where you run the vagrant commands, simply:

export SSH_AUTH_SOCK=""
4
  • Any comment for the downvote?
    – Jakuje
    Dec 16, 2017 at 10:48
  • Any idea on how to do this permanently? Nov 27, 2018 at 14:36
  • The other answer sounds like permanent solution. Or you can write this into your ~/.bashrc. It will practically disable it permanently for all the sessions. (after relogin).
    – Jakuje
    Nov 28, 2018 at 9:24
  • 1
    Works great for me. To disable it for just a single connection (while preserving the agent in the terminal session), I ran a command like this: SSH_AUTH_SOCK="" ssh user@127.0.0.1
    – n_moen
    Jan 31 at 4:33
4

eval $(ssh-agent -k) kills the agent in the current terminal.

It runs these commands

unset SSH_AUTH_SOCK;
unset SSH_AGENT_PID;
echo Agent pid 89141 killed;
3
launchctl stop com.openssh.ssh-agent

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .