一、查看服务器是否安装了rsh
一般情况下,linux服务器都有rsh功能,但出于保险起见,最好查看一下,作者本人就因为某台服务器rsh命令所需要的系统包没安装(或被人误删了)而在其他地方找了半天原因,结果可想而知。
查看方法:rpm –qa|grep rsh
正常结果:rsh-0.17-17
rsh-server-0.17-17
执行结果中若不包含这两行(可能版本号会有不同,不用抠牛角尖),搭建环境可能会出现问题。鉴于本人将某台服务器修复好后,rpm –qa|grep rsh结果还是只有一个rsh-0.17-17,建议先把环境搭好再说
(以上没有问题可直接跳转至二,有问题的话也先直接跳转至二^_^,最后看这里)
若出现该问题处理方法如下:
1、#uname –a 查看Linux内核
#cat /etc/redhat-release 查看Linux版本
2、下载合适的.rpm包,建议网站:http://www.rpmfind.net/
例:rsh包--------------rsh-0.17-25.4.src.rpm
Rsh-server包--- rsh-server-0.17-25.4.i386.rpm
以上的包根据机器操作系统进行搜索,然后执行:
rpm -ivh rsh-server-0.17-25.4.i386.rpm(本人就缺一个rsh-server,故下载对应包执行即可)
3、若/etc/xinetd.d目录下没有rsh、rexec、rlogin,请添加这三个文件
[root@database3 root]# 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
{
disable = no
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rshd
}
[root@database3 root]# cat /etc/xinetd.d/rexec
# default: off
# description: Rexecd is the server for the rexec(3) routine. The server \
# provides remote execution facilities with authentication based \
# on user names and passwords.
service exec
{
disable = no
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rexecd
}
[root@database3 root]# cat /etc/xinetd.d/rlogin
# default: on
# description: rlogind is the server for the rlogin(1) program. The server \
# provides a remote login facility with authentication based on \
# privileged port numbers from trusted hosts.
service login
{
disable = no
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rlogind
}
二、打开rsh、rcp、rlogin命令权限
1、 运行setup,进入系统服务,将rsh/rlogin/rexec选中,退出
2、 查看/etc/xinetd.d目录下有没有rsh、rexec、rlogin文件,若没有,请添加,内容请参考第一大步骤3小步骤
3、 若/etc/xinetd.d目录下有rsh、rexec、rlogin文件,请将disable = yes改为disable = no(受控端设置)
4、 若服务器设置了防火墙,请打开512\513\514端口(受控端设置)
5、 修改配置文件(受控端设置)
#vi /etc/securetty再里面添加rsh rexec rlogin。
或者
#echo "rexec" >>/etc/securetty
#echo "rlogin" >>/etc/securetty
#echo "rsh" >>/etc/securetty
三、建立服务器之间的访问互信,使rsh、rcp免密码执行
1、 主目录下建立文件.rhosts
主控端服务器在此文件中添加信任的受控端服务器ip
[root@database3 root]# cat .rhosts
192.168.1.103
192.168.1.106
192.168.1.107
192.168.1.108
192.168.1.109
受控端服务器在此文件中添加主控端服务器ip
[root@database6 root]# cat .rhosts
192.168.1.102
2、添加信息至/etc/hosts文件
主控端设置信任的受控端服务器ip及用户
[root@database3 root]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 database2 localhost.localdomain localhost (系统原有)
192.168.1.106 root
192.168.1.103 root
192.168.1.107 root
192.168.1.108 root
192.168.1.109 root
3、添加信息至/etc/hosts.equiv
受控端设置信任的主控端ip
[root@database7 root]# cat /etc/hosts.equiv
192.168.1.102
4、添加信息至/etc/hosts.allow
受控端设置信任的主控端ip
[root@database7 root]# cat /etc/hosts.allow
#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
in.rshd:192.168.1.102
in.rlogind:192.168.1.102
portmap:192.168.1.102
sshd:192.168.1.102
四、重启服务进行测试
1、受控端执行:# service xinetd restart
2、受控端执行:若使用防火墙# service iptables restart
3、主控端执行:
#rlogin 192.168.1.106 看是否实现了无密码登陆
#rsh 192.168.1.106 sh gd_ctrl.sh 看是否执行了gd_ctrl.sh脚本
执行结果中若不包含这两行(可能版本号会有不同,不用抠牛角尖),搭建环境可能会出现问题。鉴于本人将某台服务器修复好后,rpm –qa|grep rsh结果还是只有一个rsh-0.17-17,建议先把环境搭好再说
(以上没有问题可直接跳转至二,有问题的话也先直接跳转至二^_^,最后看这里)
若出现该问题处理方法如下:
1、#uname –a 查看Linux内核
#cat /etc/redhat-release 查看Linux版本
2、下载合适的.rpm包,建议网站:http://www.rpmfind.net/
例:rsh包--------------rsh-0.17-25.4.src.rpm
Rsh-server包--- rsh-server-0.17-25.4.i386.rpm
以上的包根据机器操作系统进行搜索,然后执行:
rpm -ivh rsh-server-0.17-25.4.i386.rpm(本人就缺一个rsh-server,故下载对应包执行即可)
3、若/etc/xinetd.d目录下没有rsh、rexec、rlogin,请添加这三个文件
[root@database3 root]# 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
{
disable = no
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rshd
}
[root@database3 root]# cat /etc/xinetd.d/rexec
# default: off
# description: Rexecd is the server for the rexec(3) routine. The server \
# provides remote execution facilities with authentication based \
# on user names and passwords.
service exec
{
disable = no
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rexecd
}
[root@database3 root]# cat /etc/xinetd.d/rlogin
# default: on
# description: rlogind is the server for the rlogin(1) program. The server \
# provides a remote login facility with authentication based on \
# privileged port numbers from trusted hosts.
service login
{
disable = no
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rlogind
}
二、打开rsh、rcp、rlogin命令权限
1、 运行setup,进入系统服务,将rsh/rlogin/rexec选中,退出
2、 查看/etc/xinetd.d目录下有没有rsh、rexec、rlogin文件,若没有,请添加,内容请参考第一大步骤3小步骤
3、 若/etc/xinetd.d目录下有rsh、rexec、rlogin文件,请将disable = yes改为disable = no(受控端设置)
4、 若服务器设置了防火墙,请打开512\513\514端口(受控端设置)
5、 修改配置文件(受控端设置)
#vi /etc/securetty再里面添加rsh rexec rlogin。
或者
#echo "rexec" >>/etc/securetty
#echo "rlogin" >>/etc/securetty
#echo "rsh" >>/etc/securetty
三、建立服务器之间的访问互信,使rsh、rcp免密码执行
1、 主目录下建立文件.rhosts
主控端服务器在此文件中添加信任的受控端服务器ip
[root@database3 root]# cat .rhosts
192.168.1.103
192.168.1.106
192.168.1.107
192.168.1.108
192.168.1.109
受控端服务器在此文件中添加主控端服务器ip
[root@database6 root]# cat .rhosts
192.168.1.102
2、添加信息至/etc/hosts文件
主控端设置信任的受控端服务器ip及用户
[root@database3 root]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 database2 localhost.localdomain localhost (系统原有)
192.168.1.106 root
192.168.1.103 root
192.168.1.107 root
192.168.1.108 root
192.168.1.109 root
3、添加信息至/etc/hosts.equiv
受控端设置信任的主控端ip
[root@database7 root]# cat /etc/hosts.equiv
192.168.1.102
4、添加信息至/etc/hosts.allow
受控端设置信任的主控端ip
[root@database7 root]# cat /etc/hosts.allow
#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
in.rshd:192.168.1.102
in.rlogind:192.168.1.102
portmap:192.168.1.102
sshd:192.168.1.102
四、重启服务进行测试
1、受控端执行:# service xinetd restart
2、受控端执行:若使用防火墙# service iptables restart
3、主控端执行:
#rlogin 192.168.1.106 看是否实现了无密码登陆
#rsh 192.168.1.106 sh gd_ctrl.sh 看是否执行了gd_ctrl.sh脚本
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16856446/viewspace-706234/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/16856446/viewspace-706234/