概述
项目需求,需要部署一个支持ipv6的rsh-server进行测试,网上有部分资料,但按照其操作之后不好使。后经多方学习,终于解决。此处记录,以备忘。
安装服务器和客户端
sudo apt-get install rsh-client rsh-server xinetd
rsh-server:rsh服务器;
rsh-client:rsh客户端;
xinetd:extended internet daemon,是一个网络守护进程服务程序,又叫超级Internet服务器,常用来管理多种轻量级Internet服务,比如Telnet、ssh等都可以通过其进行管理,可以关注一下其配置文件/etc/xinetd.conf。
配置rsh服务参数
- 检查/etc/xinetd.d/目录下是否有如下文件:
/etc/xinetd.d/rsh
/etc/xinetd.d/rlogin
/etc/xinetd.d/rexec
- 若以上文件不存在则创建,若存在则按照如下内容修改,若要支持IPv6请添加flags=IPv6参数:
- /etc/xinetd.d/rsh
# default: on
# descrīption: 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
flags = IPv6
}
- /etc/xinetd.d/rlogin
# default: on
# descrīption: 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
flags = IPv6
}
- /etc/xinetd.d/rexec
# default: off
# descrīption: 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
flags = IPv6
}
启动服务器
lxm@ubuntu:/etc/xinetd.d$ sudo service xinetd restart
xinetd stop/waiting
xinetd start/running, process 36722
lxm@ubuntu:/etc/xinetd.d$ netstat -antp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 280 127.0.0.1:513 127.0.0.1:1021 ESTABLISHED -
tcp 0 0 127.0.0.1:1021 127.0.0.1:513 ESTABLISHED -
tcp6 0 0 :::80 :::* LISTEN -
tcp6 0 0 ::1:631 :::* LISTEN -
tcp6 0 0 :::512 :::* LISTEN -
tcp6 0 0 :::513 :::* LISTEN -
tcp6 0 0 :::514 :::* LISTEN -
tcp6 1 0 ::1:34134 ::1:631 CLOSE_WAIT -
可以看到,端口512/513/514三个rsh相关的端口已处于监听状态,表示服务启动成功。
启动客户端测试
首先自己保证两端是通的(该处不赘述)
之后在客户端启动rsh连接;此处8001::130对应rsh服务器地址,8001::133对应rsh客户端地址。
lxm@ubuntu01:~$ rsh 8001::130
Password:
Last login: Thu Oct 31 11:41:23 CST 2019 from 8001::133 on pts/11
Welcome to Ubuntu 14.04.6 LTS (GNU/Linux 4.4.0-142-generic x86_64)
* Documentation: https://help.ubuntu.com/
Your Hardware Enablement Stack (HWE) is supported until April 2019.
lxm@ubuntu:~$
lxm@ubuntu:~$
可以看到,通过rsh,客户端lxm@ubuntn01连接到了服务器lxm@ubuntu。
之后就可以执行命令了。
over