rsh, rexec教程

介绍

rsh和rexec用来从远程机器执行命令,然后把结果返回到host上。因为Linux默认的安全性做的很好,需要有很多设置才能完成rsh,rexc的功能。尤其像目前项目的需要是用root来远程执行一系列命令。

 

设置

如果把执行的机器称为master,目标机器称为slave。则你需要在slave机器上先做以下配置。

 

1. yum install -y rsh-server

2. cd /etc/xinetd.d/, change rsh, rexec "diable = yes" to "disable = no"

3. vi /etc/securetty, add "rsh", "rexec"

4. vi /etc/security/access.conf

    + : root : ipaddr/32

5. vi /etc/hosts.allow

    in.rshd:ALL

6. delete following line in /etc/pam.d/rsh

auth       required     pam_rhosts_auth.so

7. vi ~/.rhosts
ipaddr root
8. chmod 600 ~/.rhosts

9. service xinetd restart

10. service iptables stop

 

在master上, 用root执行

1. yum install -y rsh rexec

2. rsh <ip addr> cat /proc/cpuinfo

 

Trouble shooting

1. Google

2. tail -f /var/log/messages

 

Reference

http://forums.fedoraforum.org/showthread.php?t=57722

http://space.itpub.net/9240380/viewspace-628880

LoadRunner监控Linux rstat协议允许网络上的用户获得同一网络上各机器的性能参数。 需要下载3个包: (1)rsh-0.17-14.i386.rpm (2)rsh-server-0.17-14.i386.rpm (3)rpc.rstatd-4.0.1.tar.gz 一、安装rsh 查看是否安装并卸载rsh [root@localhost /]# rpm –qa |grep rsh      --查看是否安装rsh [root@localhost /]# rpm –e + 版本号   --卸载该版本 安装rsh,rsh-server [root@localhost /]# rpm –ivh rsh-0.17-14.i386.rpm [root@localhost /]# rpm –ivh rsh-server-0.17-14.i386.rpm 二、安装rstatd 下载并安装rstatd,下载地址:http://sourceforge.net/projects/rstatd,上传至/usr/local 查看是否安装,一般来说Linux都没有安装 [root@localhost /]# find / -name rpc.rstatd 安装rstatd [root@localhost /]# tar -xzvf rpc.rstatd-4.0.1.tar.gz [root@localhost /]# cd rpc.rstatd-4.0.1 [root@localhost /]# ./configure [root@localhost /]# make [root@localhost /]# make install 三、安装完成后配置rstatd目标守护进程xinetd,配置文件于/etc/xinet.d目录下 修改/etc/xinetd.d目录下面的3个conf(rogin,rsh,rexec)中的disable均设置为no [root@localhost /]# cd /etc/xinetd.d      --进入到/etc/xinetd.conf目录中 [root@localhost /]# vi rlogin     --编辑disable=no,保存 [root@localhost /]# vi rsh  --编辑disable=no,保存 [root@localhost /]# vi rexec --编辑disable=no,保存 四、启动rpc.rstatd [root@localhost /]# rpc.rstatd --启动rpc.rstatd进程 [root@localhost /]# rpcinfo -p --执行此命令检查rpc服务的状态 如果未出现上图的rstatd说明没有安装成功,需要重复以上步骤。 到这里为止,LR监控Linux必要的服务都已安装好了。 五、关闭防火墙 [root@localhost /]# service iptables stop 六、利用LR中的Controller监控Linux资源 在Controller中,将System Resource Graphs中的Unix resources拖到右侧的资源监控区域。 鼠标右键选择Add Measurements,添加被监控Linux的IP地址x.x.x.x,选择需要监控的性能指标,确认。 七、遇到的问题 1. LoadRunner监控Linux资源时弹出如下错误: Monitor name :UNIX Resources. Cannot initialize the monitoring on 192.168.52.189. Error while creating the RPC client. Ensure that the machine can be connected and that it runs the rstat daemon (use rpcinfo utility for this
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值