sshpass实现批量基于ssh的key部署

#!/bin/bash
# 
#********************************************************************
#Author:            will
#QQ:                1052165684
#Date:              2021-01-16
#FileName:         push_ssh_key.sh
#URL:               www.xxx.com
#Description:      The test script
#Copyright (C):     2021 All rights reserved
#********************************************************************
. /etc/init.d/functions
yum -y install sshpass                                                                                                                                                                                           
ip="
10.0.0.17
10.0.0.7
10.0.0.19"
[ -f /root/.ssh/id_rsa ] || ssh-keygen -P "" -t rsa -f /root/.ssh/id_rsa
export SSHPASS=123456

for i in $ip;do
    sshpass -e  ssh-copy-id -o StrictHostKeyChecking=no root@$i &> /dev/null && action "push key to $i is successufll"
done

 

上一篇:怎么证明权重不相同的加权无向图的最小生成树是唯一的 (图论)


下一篇:oracle自动备份linux