From e73de1c800eee37d7feff0c834a2d9b2c7f13806 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 3 Apr 2009 20:00:06 +0000 Subject: [PATCH] also create a config file in the /.ssh directory incase they have deleted that also git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3090 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/xdsh | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/xCAT-client/bin/xdsh b/xCAT-client/bin/xdsh index 6ed92d2bd..a52f7aea8 100644 --- a/xCAT-client/bin/xdsh +++ b/xCAT-client/bin/xdsh @@ -291,6 +291,25 @@ sub parse_args_xdsh $ENV{DSH_REMOTE_PASSWORD} = $userpw; } + # Get the home directory + my $home = xCAT::Utils->getHomeDir($current_userid); + $ENV{'DSH_FROM_USERID_HOME'} = $home; + # add config file with strict host checking no + my $cmd = "echo \"StrictHostKeyChecking no\" >> $home/.ssh/config"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { # error + $msg = "Error from $cmd\n"; + xCAT::MsgUtils->message("E", $msg); + } + + my $cmd = "chmod 0600 $home/.ssh/config"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { # error + $msg = "Error from $cmd\n"; + xCAT::MsgUtils->message("E", $msg); + } # if current_userid is not "root", we need to generate the keys # here before becoming root while running under xcatd @@ -307,9 +326,6 @@ sub parse_args_xdsh } $::REMOTE_SHELL = "/usr/bin/ssh"; - # Get the home directory - my $home = xCAT::Utils->getHomeDir($current_userid); - $ENV{'DSH_FROM_USERID_HOME'} = $home; # generates new keys, if they do not already exist xCAT::Utils->runcmd("$::REMOTESHELL_EXPECT -k", 0); @@ -321,22 +337,6 @@ sub parse_args_xdsh } - # add config file with stict host checking no - my $cmd = "echo \"StrictHostKeyChecking no\" >> $home/.ssh/config"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { # error - $msg = "Error from $cmd\n"; - xCAT::MsgUtils->message("E", $msg); - } - - my $cmd = "chmod 0600 $home/.ssh/config"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { # error - $msg = "Error from $cmd\n"; - xCAT::MsgUtils->message("E", $msg); - } } } # end setup of ssh if ($options{'version'})