From 519bb5b728cf200db70e581e6cf60c508ae5fec9 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 1 Nov 2010 19:12:36 +0000 Subject: [PATCH] add check to see if ssh passwordless root login is to be setup on the node per design, see https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Disable_ssh_root_passwordless_node-to-node_access#1._Overview git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7995 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT/postscripts/remoteshell | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/xCAT/postscripts/remoteshell b/xCAT/postscripts/remoteshell index 5a65b97bb..8f71486c7 100755 --- a/xCAT/postscripts/remoteshell +++ b/xCAT/postscripts/remoteshell @@ -110,11 +110,13 @@ umask 0077 mkdir -p /root/.ssh/ sleep 1 -getcredentials.awk ssh_root_key | grep -E -v '|'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/ssh_root_key +if [ $ENABLESSHBETWEENNODES = "YES" ]; +then + getcredentials.awk ssh_root_key | grep -E -v '|'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/ssh_root_key -#check whether the message is an error or not -grep -E '' /tmp/ssh_root_key -if [ $? -ne 0 ]; then + #check whether the message is an error or not + grep -E '' /tmp/ssh_root_key + if [ $? -ne 0 ]; then #The message contains the data we request cat /tmp/ssh_root_key | grep -E -v '||' > /root/.ssh/id_rsa logger -t xCAT ssh_root_key @@ -126,18 +128,19 @@ if [ $? -ne 0 ]; then getcredentials.awk ssh_root_key | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /root/.ssh/id_rsa MYCONT=`cat /root/.ssh/id_rsa` done -else + else #This is an error message ERR_MSG=`sed -n 's%.*\(.*\).*%\1%p' /tmp/ssh_root_key` logger -t xCAT ssh_root_key Error: $ERR_MSG -fi -rm /tmp/ssh_root_key + fi + rm /tmp/ssh_root_key -if ! grep "PRIVATE KEY" /root/.ssh/id_rsa > /dev/null 2>&1 ; then - rm /root/.ssh/id_rsa -fi -if [ -r /root/.ssh/id_rsa ]; then - ssh-keygen -y -f /root/.ssh/id_rsa > /root/.ssh/id_rsa.pub + if ! grep "PRIVATE KEY" /root/.ssh/id_rsa > /dev/null 2>&1 ; then + rm /root/.ssh/id_rsa + fi + if [ -r /root/.ssh/id_rsa ]; then + ssh-keygen -y -f /root/.ssh/id_rsa > /root/.ssh/id_rsa.pub + fi fi # start up the sshd for syncfiles postscript to do the sync work