首页 > 系统 > Linux > 正文

Linux机器添加互信脚本

2024-06-28 16:04:25
字体:
来源:转载
供稿:网友

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
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表