Created
November 7, 2014 13:23
-
-
Save viktorbenei/ae99d688674b517d0434 to your computer and use it in GitHub Desktop.
kill ssh agent and load a new one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "----------------" | |
echo "Removing existing keys" | |
ssh-add -K | |
echo "----------------" | |
echo "List of keys:" | |
ssh-add -l | |
echo "----------------" | |
ssh-agent -k | |
eval $(ssh-agent) | |
echo >> ~/.bashrc | |
echo "export SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> ~/.bashrc | |
echo "----------------" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ssh-add -K
is not an option for BSD.https://help.github.com/articles/error-ssh-add-illegal-option-k/
Also, anyone reading this might want to review http://rabexc.org/posts/pitfalls-of-ssh-agents for a better way.