#!/bin/bash
#rsh无密码登陆 解决pdsh的rsh模块连接问题
#运行前提 保证yum源正常 并且 可以上网
#target:
#clone1.host.com 192.168.1.30
#clone2.host.com 192.168.1.35 ==> 三者无密码互通 下面的脚本每个机器都要运行
#clone3.host.com 192.168.1.34
#是否安装pdsh时候装了rsh模块
rsgFlag=`pdsh -V | grep rsh|wc -l`
if [ $rsgFlag -lt 1 ]
then
echo "You never install pdsh with rsh modules!"
echo "Please you sholud recheck!"
exit
fi
############# 依据自己的环境而定BEGIN###############
###这一步不是每个环境都使用哈
echo "192.168.1.30 clone1.host.com" >>/etc/hosts
echo "192.168.1.35 clone2.host.com" >>/etc/hosts
echo "192.168.1.34 clone3.host.com" >>/etc/hosts
#添加主机名
echo "clone1.host.com" >>/etc/hosts.equiv
echo "clone2.host.com" >>/etc/hosts.equiv
echo "clone3.host.com" >>/etc/hosts.equiv
#读取/etc/hosts.equiv到/root/.rhosts
cat /etc/hosts.equiv >> /root/.rhosts
sed -i 's/$/ root/' /root/.
rsh无密码登陆
最新推荐文章于 2023-08-03 18:49:21 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)