summaryrefslogtreecommitdiff
path: root/remove-known-host.sh
blob: d2c8b8d5d8a6d888d2a8896cd6d5bd2803448c54 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

if [ -z "$1" ]; then
  echo "$0 <host>"
  exit 1
fi

SHORT="$1"
SSH_HOST=$(ssh -G "$1" | grep "^hostname " | awk '{ print($2) }' )

for name in $SHORT $SSH_HOST; do
  ssh-keygen -f "$HOME/.ssh/known_hosts" -R "$name"
done

exit 0