diff --git a/misc/cpnetools.sh b/misc/cpnetools.sh index a6662c60..ce2249e2 100644 --- a/misc/cpnetools.sh +++ b/misc/cpnetools.sh @@ -3,7 +3,7 @@ tooldir=/usr/local/bin toollist="zip unzip" -#分发到各个节点,这里分发到nehosts文件中的主机中. +# distribute to hosts in file nehosts while read line do if [[ "$line" =~ ^[^[:space:]]*# || -z "$line" ]]; then diff --git a/misc/cpsshkey.sh b/misc/cpsshkey.sh index 8aa933d0..3f0d5a3b 100644 --- a/misc/cpsshkey.sh +++ b/misc/cpsshkey.sh @@ -1,29 +1,36 @@ #!/bin/bash -# 判断id_rsa密钥文件是否存在 +# if exist id_rsa if [ ! -f ~/.ssh/id_rsa ];then ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa else echo "id_rsa has created ..." fi -#分发到各个节点,这里分发到nehosts文件中的主机中. +# distribute to hosts in file nehosts while read line do + # ignore comment or null line if [[ "$line" =~ ^[^[:space:]]*# || -z "$line" ]]; then continue - fi - user=`echo $line | cut -d " " -f 2` + fi + ip=`echo $line | cut -d " " -f 1` + user=`echo $line | cut -d " " -f 2` passwd=`echo $line | cut -d " " -f 3` - + + # !!! to remove ~/.ssh, all old authorized key will be lost expect <