LINUX 远程管理服务,安装。无人值守。 ssh首次登陆输入yes

# 批量安装sshpass.
# -o StrictHostKeyChecking=no 跳过ssh首次连接时需要输入yes
for ip in 172.16.116.{188..191}; do 
	sshpass -pwww.39doo.com ssh -o StrictHostKeyChecking=no root@$ip 'yum install sshpass -y'; 
done

批量执行本地脚本

for ip in 172.16.116.{188..191}; do 
	sshpass -pwww.39doo.com ssh -o StrictHostKeyChecking=no root@$ip < ./hosts.sh; 
done

批量执行远程脚本

for ip in 172.16.116.{188..191}; do 
	sshpass -pwww.39doo.com ssh -o StrictHostKeyChecking=no root@$ip  "./hosts.sh"; 
done

你可能感兴趣的:(linux,ssh,运维)