Skip to content

Instantly share code, notes, and snippets.

@silverbeak
Created January 15, 2019 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silverbeak/df858fd3ba8f3f491ca57ffc78b7d701 to your computer and use it in GitHub Desktop.
Save silverbeak/df858fd3ba8f3f491ca57ffc78b7d701 to your computer and use it in GitHub Desktop.
At work, we keep reinstalling our test servers. I use this script to remove outdated known_host keys
#!/bin/sh
# When the error message says something to the effect of
# Offending ECDSA key in /Users/xxx/.ssh/known_hosts:52
# Use the script like this:
# > rmhost 52
# to remove line 52 from the known_hosts file
# NB! Naturally, make sure to KNOW that the key is ok to be removed. Like the warning says
# IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
sed -i "" "${1}d" /Users/kristoferjarl/.ssh/known_hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment