If you need to set up a passwordless SSH between multiple hosts, you can try the following script to do it automatically for you rather than manually copying the keys from one hosts to another.

The script needs an input file ip.txt that has server information for all hosts. The format of this file is:

ip.txt

Node_# IP_Address GW_Address FQDN
For example:
01 192.168.142.101 192.168.142.2 pnode01.purescale.ibm.local
02 192.168.142.102 192.168.142.2 pnode02.purescale.ibm.local
03 192.168.142.103 192.168.142.2 pnode03.purescale.ibm.local
04 192.168.142.104 192.168.142.2 pnode04.purescale.ibm.local

The server information file ip.txt is assumed to be in the ./backup directory. The script genSSH is as follows or download from here.

#!/bin/bash

if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root" 1>&2
   exit 1
fi

if [ $# -lt 4 ] ; then
    echo "Usage: $0 USER_NAME USRER_PASSWORD USER_GROUP USER_HOME"
    echo "Usage: $0 root password root /root"
    echo "Usage: $0 db2psc password db2iadm /home/db2psc"
    exit 1
fi

function runrcmd ()
{
     expect -c "
     set timeout 2
     spawn $1 
     expect eof { return; }
     expect \"yes/no\" { send \"yes\r\" }
     expect \"*Password:*\" { send \"$USERPW\r\" }
     expect \"(.*)\r\"
    " >> $LOGFILE
}

USERNM=$1
USERPW=$2
USERGP=$3
USERHM=$4
SCHOME=./backup
IPFILE=$SCHOME/ip.txt
KNOWN_HOSTS=$SCHOME/known_hosts
LOGFILE=$SCHOME/$0.log

> $LOGFILE
> $KNOWN_HOSTS
############### Build server list from ip.txt #####
i=0
while read a b c d
do
  SHORTNM=${d%%.*}
  servers[$i]=$SHORTNM
  ((i++))
  echo Generate hosts keys for $SHORTNM
  ssh-keyscan $SHORTNM >> $KNOWN_HOSTS
  ssh-keyscan $d >> $KNOWN_HOSTS
  ssh-keyscan $b >> $KNOWN_HOSTS
  ssh-keyscan $b,$SHORTNM,$d >> $KNOWN_HOSTS
done < $IPFILE
echo "server list " ${servers[@]}

########################################################
for ((i = 0; i < ${#servers[@]}; ++i));
do
  server=${servers[$i]};
  echo Deleting ${USERHM}/.ssh on $server
  runrcmd "/usr/bin/ssh $server \"rm -fr ${USERHM}/.ssh\""
  echo Generating private/public keys for ${USERHM}/.ssh on $server
  runrcmd "/usr/bin/ssh $server \"su -l ${USERNM} -c \\\"ssh-keygen -t rsa -N '' -f ~/.ssh/id_dsa\\\"\""
  echo Sending known_hosts to the ${USERHM}/.ssh on $server
  runrcmd "/usr/bin/scp $SCHOME/known_hosts ${USERNM}@$server:${USERHM}/.ssh/known_hosts"
  echo Setting chmod 600 to ${USERHM}/.ssh/known_hosts on $server
  runrcmd "/usr/bin/ssh $server \"chmod 600 ${USERHM}/.ssh/known_hosts\""
  echo Fixing owner for ${USERHM}/.ssh/known_hosts on $server
  runrcmd "/usr/bin/ssh $server \"chown ${USERNM}.${USERGP} ${USERHM}/.ssh/known_hosts\""
  echo Getting id_dsa.pub from ${USERHM}/.ssh on $server
  runrcmd "/usr/bin/scp ${USERNM}@$server:${USERHM}/.ssh/id_dsa.pub $SCHOME/${USERNM}.id_dsa.pub.$server"
done
> $SCHOME/authorized_keys.${USERNM}
for server in ${servers[@]};
do
  echo Combining id_dsa.pub from $server into authorized_keys
  cat $SCHOME/${USERNM}.id_dsa.pub.$server >> $SCHOME/authorized_keys.${USERNM}
  cat $SCHOME/${USERNM}.id_dsa.pub.$server >> $SCHOME/authorized_keys.${USERNM}
  rm -f $SCHOME/${USERNM}.id_dsa.pub.$server
  rm -f $SCHOME/${USERNM}.id_dsa.pub.$server
done
echo Copying authorized_keys
for server in ${servers[@]};
do
  echo Copying authorized_keys of ${USERNM} to the $server
  runrcmd "/usr/bin/scp $SCHOME/authorized_keys.${USERNM} ${USERNM}@$server:${USERHM}/.ssh/authorized_keys"
  echo Fixing authorized_keys permissions for ${USERNM} on the $server
  /usr/bin/ssh $server "chmod 600 ${USERHM}/.ssh/authorized_keys"
  echo Fixing owner for authorized_keys for ${USERNM} on the $server
  /usr/bin/ssh $server "chown ${USERNM}.${USERGP} ${USERHM}/.ssh/authorized_keys"
done
rm -f $SCHOME/authorized_keys.${USERNM}
rm -f $KNOWN_HOSTS

Example: To set up passwordless SSH for root # ./genSSH root password root /root To setup passwordless for a user db2psc # ./genSSH db2psc password db2iadm /home/db2psc