利用sshpass批量导入ssh-key

!/bin/bash

set +x
base_dir=$(pwd)
ip_list='10.200.7.28,10.200.7.29,10.200.7.30,10.200.7.31'
USER='root'
PWD='123456'

INSTALL()
{
echo "开始导入public-key"
sleep 1s
for IP in echo "${ip_list}"|awk -F, 'BEGIN{OFS=" "}{$1=$1;printf("%s",$0);}'
do
sshpass -p {USER}@{IP}服务器完成"
done
}

INSTALL

你可能感兴趣的:(利用sshpass批量导入ssh-key)