yum install -y expectssh-keygen -t rsa -P "" -f /root/.ssh/id_rsaexport mypass=123456 name=(node1 node2 node3 node4)for i in ${name[@]};doexpect -c "spawn ssh-copy-id -i /root/.ssh/id_rsa.pub root@$i expect { "*yes/no*" {send "yesr"; exp_continue} "*password*" {send "$mypassr"; exp_continue} "*Password*" {send "$mypassr";} }"done
互信脚本使用
时间:2023-07-22
相关推荐