#! /bin/bash TMP_PASS=$(cat $HOME/passwd.dat) echo '$USER=' $USER 'TMP_PASS=' $TMP_PASS ## Generate two files, id_rsa and id_rsa.pub, in $HOME/.ssh in the current compute node echo 1. Generate two files, id_rsa and id_rsa.pub, in $HOME/.ssh in the current compute node $(echo $(hostname)) if [[ -e $userhome/.ssh/id_rsa.pub ]]; then echo "pub rsa exists. Will not create any."; else ssh-keygen -t rsa; fi echo ' ' echo 2. ssh-id-copy the rsa key of the user $USER from the node $(echo $(hostname)) the frontend sshpass -f <(printf '%s\n' $TMP_PASS ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.1.10" if [ "$(whoami)" = 'root' ] then echo 3. I am root else echo 3. I am $(whoami). Now in $(echo $(hostname)) doing gen_bashrc /share/apps/local/bin/gen_bashrc.txt fi echo ' '