Last active
August 29, 2015 14:07
-
-
Save corny/6861840992536891ec81 to your computer and use it in GitHub Desktop.
Update script for known_hosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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