#!/bin/bash
# 利用sshpass批量实现基于key验证
# 192.168.100.{1..200}
[ -f /root/.ssh/id_rsa ] || ssh-keygen -f /root/.ssh/id_rsa -P ''
rpm -q sshpass &> /dev/null || yum install sshpass -y &> /dev/null
net=192.168.100
user=root
export SSHPASS=123456
for i in {1..200}
do
{
sshpass -e ssh-copy-id $net.$i -o StrictHostKeyChecking=no $user@$net.$i &> /dev/null && action "push key to $net.$i is successfully."
}&
done
利用sshpass批量实现基于key验证
最新推荐文章于 2023-02-13 18:31:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)