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)?" {