Linux机器添加互信脚本

来源:互联网 发布:mac打开远程桌面连接 编辑:程序博客网 时间:2024/06/01 22:46

SUSE机器添加互信

#!/bin/bashnum=1nump=”$num””p”for i in ‘cat ip.txt’doecho “ip:”$ipaswd=’sed –n “$nump” paswd.txt’echo “passwd:”$paswd/usr/bin/expect <<EOFset timeout -1spawn ssh-copy-id –i /root/.ssh/id_rsa.pub root@$iexpect “*(yes/no)?” {send “yes\r”}expect “*Password:” {send “$paswd\r”}expect eofEOFLet num++nump=”$num””p”done

centOS机器添加互信

#!/bin/bashnum=1nump=”$num””p”for i in ‘cat ip.txt’doecho “ip:”$ipaswd=’sed –n “$nump” paswd.txt’echo “passwd:”$paswd/usr/bin/expect <<-EOFspawn ssh-copy-id –i /root/.ssh/id_rsa.pub root@$iexpect “*Password:” send “$paswd\r”expect eofEOFLet num++nump=”$num””p”done


0 0