Skip to content

Instantly share code, notes, and snippets.

@tresni
Created October 10, 2018 05:48
Show Gist options
  • Save tresni/66576b47eaafa6c6f9b27a358ca7cfb5 to your computer and use it in GitHub Desktop.
Save tresni/66576b47eaafa6c6f9b27a358ca7cfb5 to your computer and use it in GitHub Desktop.
#!/bin/sh
reset_host() {
all="$1 $(dig +short $1) $(dig +short aaaa $1)"
for ident in $all
do
ssh-keygen -f ~/.ssh/known_hosts -R $ident
ssh-keyscan $ident >>~/.ssh/known_hosts
done
}
if [ $# -ne 1 ]; then
while read line; do
reset_host $line
done;
else
for h; do
reset_host $h
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment