Linux机器添加互信脚本
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux机器添加互信脚本相关的知识,希望对你有一定的参考价值。
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
以上是关于Linux机器添加互信脚本的主要内容,如果未能解决你的问题,请参考以下文章