must create .ssh directory, if it does not exist before creating the config file in it

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5485 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2010-03-16 16:59:48 +00:00
parent 4f0f101510
commit 7161b971e5

View File

@ -369,6 +369,21 @@ sub parse_args_xdsh
# Get the home directory
my $home = xCAT::Utils->getHomeDir($current_userid);
$ENV{'DSH_FROM_USERID_HOME'} = $home;
#
# create /.ssh dir if needed
#
my $sshdir = "$home/.ssh";
if (!-d $sshdir)
{
my $cmd = "/bin/mkdir -m 700 -p $sshdir";
my $outref = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
{
xCAT::MsgUtils->message('E', "Could not create $sshdir directory.");
exit 1;
}
}
# add config file with strict host checking no
my $cmd = "echo \"StrictHostKeyChecking no\" >> $home/.ssh/config";