Skip to content

Instantly share code, notes, and snippets.

@corny
Last active August 29, 2015 14:07
Show Gist options
  • Save corny/6861840992536891ec81 to your computer and use it in GitHub Desktop.
Save corny/6861840992536891ec81 to your computer and use it in GitHub Desktop.
Update script for known_hosts
#!/bin/sh -e
if [ "$#" = "0" ]; then
echo "missing hosts"
exit 1
fi
for host in $@; do
inet=`dig +short a $host`
inet6=`dig +short aaaa $host`
for entry in $host $inet $inet6; do
ssh-keygen -f "$HOME/.ssh/known_hosts" -R $entry 2> /dev/null
done
ssh -o StrictHostKeyChecking=no root@$host true
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment