Skip to content

Instantly share code, notes, and snippets.

@furlongm
Created November 1, 2017 02:59
Show Gist options
  • Save furlongm/6d1b617c50489aa24958dc96c351708d to your computer and use it in GitHub Desktop.
Save furlongm/6d1b617c50489aa24958dc96c351708d to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ "$1" == "" ] ; then
echo $0 hostname.example.com
fi
host=`echo $1 | cut -d "@" -f 2`
ssh-keygen -R $host -f ~/.ssh/known_hosts
revp=`host $host | grep "has address" | sed -e "s/.*address //g"`
ssh-keygen -R $revp -f ~/.ssh/known_hosts 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment