SUSE机器添加互信
#!/bin/bash num=1 nump=”$num””p” for i in ‘cat ip.txt’ do echo “ip:”$i paswd=’sed –n “$nump” paswd.txt’ echo “passwd:”$paswd /usr/bin/expect <<EOF set timeout -1 spawn ssh-copy-id –i /root/.ssh/id_rsa.pub [email protected]$i expect “*(yes/no)?” {send “yes\r”} expect “*Password:” {send “$paswd\r”} expect eof EOF Let num++ nump=”$num””p” done
centOS机器添加互信
#!/bin/bash num=1 nump=”$num””p” for i in ‘cat ip.txt’ do echo “ip:”$i paswd=’sed –n “$nump” paswd.txt’ echo “passwd:”$paswd /usr/bin/expect <<-EOF spawn ssh-copy-id –i /root/.ssh/id_rsa.pub [email protected]$i expect “*Password:” send “$paswd\r” expect eof EOF Let num++ nump=”$num””p” done
时间: 2024-12-18 09:23:46