From 122dffca3b3ce6b8f9ab49c6c521dd3d7d43c281 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 9 Feb 2009 20:27:46 +0000 Subject: [PATCH] add copy of the private key to the nodes git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2713 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 3 +++ xCAT-server/sbin/remoteshell.expect | 30 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 9f5ba1bae..c999f5288 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -1194,6 +1194,9 @@ if (! -d \"\$dest_dir\" ) { } `cat /tmp/$to_userid/.ssh/authorized_keys >> \$home/.ssh/authorized_keys 2>&1`; `cat /tmp/$to_userid/.ssh/authorized_keys2 >> \$home/.ssh/authorized_keys2 2>&1`; +`cp /tmp/$to_userid/.ssh/id_rsa \$home/.ssh/id_rsa 2>&1`; +`cp /tmp/$to_userid/.ssh/id_dsa \$home/.ssh/id_dsa 2>&1`; +`chmod 0600 \$home/.ssh/id_* 2>&1`; `rm -f /tmp/$to_userid/.ssh/* 2>&1`; rmdir(\"/tmp/$to_userid/.ssh\"); rmdir(\"/tmp/$to_userid\");"; diff --git a/xCAT-server/sbin/remoteshell.expect b/xCAT-server/sbin/remoteshell.expect index 49bc9fc72..609a98d1f 100644 --- a/xCAT-server/sbin/remoteshell.expect +++ b/xCAT-server/sbin/remoteshell.expect @@ -282,6 +282,36 @@ if { [llength $argv] != 0 } { exec /bin/kill $pid } } + set pid [ spawn $scp $directory/id_rsa $to_userid\@$node:/tmp/$to_userid/.ssh ] + expect { + "Are you sure you want to continue connecting (yes/no)?" { + send "yes\r" + exp_continue + } + "*ssword*" { + send "$word\r" + exp_continue + } + "Permission denied*" { + exec /bin/kill $pid + } + } + set pid [ spawn $scp $directory/id_dsa $to_userid\@$node:/tmp/$to_userid/.ssh ] + expect { + "Are you sure you want to continue connecting (yes/no)?" { + send "yes\r" + exp_continue + } + "*ssword*" { + send "$word\r" + exp_continue + } + "Permission denied*" { + exec /bin/kill $pid + } + } + set pid [ spawn $scp $directory/copy.perl $to_userid\@$node:/tmp/$to_userid/.ssh ] + set pid [ spawn $scp $directory/copy.perl $to_userid\@$node:/tmp/$to_userid/.ssh ] set pid [ spawn $scp $directory/copy.perl $to_userid\@$node:/tmp/$to_userid/.ssh ] expect { "Are you sure you want to continue connecting (yes/no)?" {