Created
September 9, 2013 19:02
-
-
Save fluxrad/6500002 to your computer and use it in GitHub Desktop.
A function definition to quickly remove host+key entries from .ssh/known_hosts. Useful for when a node is replaced, or you otherwise need to remove a group of hosts.
This file contains 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
# Remove any entries from SSH known_hosts file | |
# that match the specified string. | |
sshrm () { | |
node=$1 | |
echo "Removing $node from SSH known hosts" | |
sed -i '.bak' -e "/^$node/d" ~/.ssh/known_hosts | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment