Chinaunix首页 | 论坛 | 博客
  • 博客访问: 486909
  • 博文数量: 173
  • 博客积分: 4112
  • 博客等级: 上校
  • 技术积分: 1577
  • 用 户 组: 普通用户
  • 注册时间: 2010-02-26 10:12
文章分类

全部博文(173)

文章存档

2012年(1)

2010年(172)

我的朋友

分类: LINUX

2010-03-25 23:00:12

rsh服务
 
今天,用线上的机器做实验。
线上安装了Virtual X Environment 系统并安装了两台centos5.3虚拟系统。 裸机安装的定制linux系统。
由于我们服务器集群有部分监控采用了rsh方式。
在此系统中,新装的两个虚拟系统未安装rsh服务,造成一直报警。
正好来复习下rsh。
 
rsh命令将在远程Linux系统上执行一个命令并把结果显示到您的系统中。当然,您的系统名和注册名必须在远程系统的.rhosts文件中,命令rsh有两个一般的参数,一个系统名和一个Linux命令。语法如下所示:
$rsh remote-sytem-name Linux-command

例,
$rsh 192.168.51.230  ls /root/
rsh-server-0.17-38.el5.i386.rpm
 
列出远程系统上的文件,并把它们送到本系统中的标准输出。
$rsh 192.168.51.230  ls /root/ > /home/abc(本系统)
 
引用一个重定向操作符。它变成Linux命令的一部分,包括命令的参数,文件名myfile。命令ls产生一列文件名并把它们重定向到远程系统中的一个文件 myfile中。
$rsh violet ls /home/robert'>'/home/abc(远程系统)

管道线被远程系统或本系统解释。
 
$rsh 192.168.51.230  ls /root/ | grep 11 (本系统)
$rsh 192.168.51.230  ls /root/ '|'  grep 11 (远程系统)
因rsh服务是一个不安全的传输。一般不建议使用rsh传输。

具体的开启方法:
/etc/xinetd.d/rlogin文件中disable =yes的改为
disable =no
保存退出。
还有/tec/xinetd.d/rsh文件中disable =yes的改为
disable =no
保存退出。

然会重启一下rsh服务
service xinetd restart即可
把/etc/securetty
文件加上
rsh
rlogin
ssh
三行。
 
在/root/.rhosts中添加允许访问的ip或主机名
[root@VirtualX02 ~]# vi .rhosts
dns
192.168.111.22
 
 
[root@VirtualX02 ~]# cat /etc/xinetd.d/rsh
# default: on 
# description: The rshd server is the server for the rcmd(3) routine and, \
#       consequently, for the rsh(1) program.  The server provides \
#       remote execution facilities with authentication based on \
#       privileged port numbers from trusted hosts.
service shell
{
        socket_type             = stream
        wait                    = no
        user                    = root
        log_on_success          += USERID
        log_on_failure          += USERID
        server                  = /usr/sbin/in.rshd
        disable                 = no
}
 
检测是否启动:
[root@VirtualX02 ~]# netstat -an | grep 514
tcp        0      0 0.0.0.0:514                 0.0.0.0:*                   LISTEN
 
阅读(825) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~