批量分发公钥脚本
Posted root0
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了批量分发公钥脚本相关的知识,希望对你有一定的参考价值。
centos6.6 批量分发脚本
#!/bin/bash #chuangjian,key pair rm -f /root/.ssh/id_dsa* ssh-keygen -t dsa -f /root/.ssh/id_dsa -P "" -q #install sshpass yum install sshpass -y &>/dev/null # fenfa key file for ip in `cat /server/scripts/game_ip.txt` do echo "===== fenfa key to host $ip =====" sshpass -proot密码 ssh-copy-id -i /root/.ssh/id_dsa.pub "-o StrictHostkeyChecking=no [email protected]$ip" echo "============= fenfa end ==================" echo "" done
批量检查脚本
#!/bin/bash CMD="$1" if [ $# -ge 1 ];then for ip in ·cat game_ip.txt· do echo "====== host $ip info ========" ssh $ip $CMD echo "======================================" echo "" done else exit fi
以上是关于批量分发公钥脚本的主要内容,如果未能解决你的问题,请参考以下文章
linux集群自动化搭建(生成密钥对+分发公钥+远程批量执行脚本)