Repair ssh_keys

Jika belum ada file listserver.txt, buat file  ” listserver.txt” , isi perbaris dengan ip_address akan diremote, contoh:

192.168.10.2
192.168.10.3

Buat file remote repair_key.sh

#!/bin/bash
# Repair ssh_keys
# Sigit Afandhi 2014
# Mailto: anti.trust30@yahoo.com.sg

host=$1

hostnames=`cat listserver.txt | grep -v “#”`
if [ -z “$host” ]; then
for host in ${hostnames}
do
tmp=${host}
echo “Repair keys ‘${host}’”
ssh-keygen -f “/root/.ssh/known_hosts” -R $host
done
else
tmp=${host}
echo “Repair keys ‘${tmp}’”
ssh-keygen -f “/root/.ssh/known_hosts” -R $tmp
fi

,

Leave a Reply