From 9184d33e33444e2eb156a87c67de0f48be4fc668 Mon Sep 17 00:00:00 2001 From: cxhong Date: Thu, 25 Jan 2018 02:17:03 -0500 Subject: [PATCH] remove remote host key from known_hosts file (#4722) --- xCAT-server/share/xcat/scripts/configonie | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/scripts/configonie b/xCAT-server/share/xcat/scripts/configonie index 64a78c942..0e8bab746 100755 --- a/xCAT-server/share/xcat/scripts/configonie +++ b/xCAT-server/share/xcat/scripts/configonie @@ -137,9 +137,6 @@ sub config_ssh { my $nodehash = $nodetab->getNodesAttribs(\@nodes,['ip','otherinterfaces']); foreach my $switch (@nodes) { - #remove old host key from /root/.ssh/known_hosts - $cmd = `ssh-keygen -R $switch`; - my $static_ip = $nodehash->{$switch}->[0]->{ip}; my $discover_ip = $nodehash->{$switch}->[0]->{otherinterfaces}; my $ssh_ip; @@ -153,6 +150,10 @@ sub config_ssh { print "$switch is not reachable\n"; next; } + + #remove old host key from /root/.ssh/known_hosts + $cmd = `ssh-keygen -R $switch`; + $cmd = `ssh-keygen -R $ssh_ip`; my ($exp, $errstr) = cumulus_connect($ssh_ip, $userid, $password, $timeout);