Skip to content

Instantly share code, notes, and snippets.

@silverbeak silverbeak/rmhost
Created Jan 15, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.