From fafee79e70c94cb7c04f97d3ddb429c6b8b15961 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 13 Mar 2013 10:42:14 +0000 Subject: [PATCH] support makeknowhosts on debian/ubuntu git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15480 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/xcatconfig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index d183100e1..d70e7da93 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -686,6 +686,16 @@ sub genSSHRootKeys "Added updates to the $cfgfile file."); } } + if ( -e "/etc/debian_version" ){ + my $out = `/bin/cat $cfgfile | grep 'HashKnownHosts'`; + if ( $out ){ + `/bin/sed -e 's/.*HashKnownHosts.*/HashKnownHosts no/' $cfgfile > tempcfg;mv -f tempcfg $cfgfile`; + } + else{ + `/bin/echo HashKnownHosts no >> $cfgfile`; + } + `chmod 600 $cfgfile`; + } } else { @@ -702,6 +712,11 @@ sub genSSHRootKeys { xCAT::MsgUtils->message('I', "Added updates to the $cfgfile file."); } + #debian or ubuntu, the HashKnownHosts default is yes, change it + if ( -e "/etc/debian_version" ){ + $cmd = "/bin/echo HashKnownHosts no >> $cfgfile"; + xCAT::Utils->runcmd("$cmd", 0); + } } #