1. Experimental environment
Both hosts are centos7 operating systems with minimal installation,
CPU name | IP address |
---|---|
host-134 | 192.168.153.134 |
host-135 | 192.168.153.135 |
Turn off the firewall and selinux of the two hosts before the experiment
2. Install the required services on both hosts
yum -y install rsh rsh-server xinetd ntsysv
3. Enter the command ntsysv
to open a graphical interface management to set the boot after a carriage return
Find rlogin and rsh in the opened services, press the space bar to add * in front of the two services, after adding, press the tab key to select Ok and press Enter to exit
4. Restart the xinetd service
systemctl restart xinetd
5. Write rsh and rlogin configuration files on both hosts, the content of the configuration files is the same
[root@host-134 xinetd.d]# 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@host-134 xinetd.d]# 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
{
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rlogind
disable = no
}
6. The two hosts were modified on the /etc/securetty
configuration file, the default file add about 3 lines
rexec
rsh
rlogin
7. Edit /etc/hosts on both hosts, add the ip and host name of the two hosts
[root@host-134 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.153.134 host-134
192.168.153.135 host-135
[root@host-135 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.153.134 host-134
192.168.153.135 host-135
8. Modify ~/.rhosts, add the host names of the two hosts, ip
[root@host-135 ~]# cat ~/.rhosts
host-134 root
host-135 root
[root@host-134 ~]# cat ~/.rhosts
host-134 root
host-135 root
9. Restart the xinetd service and set it to start automatically after booting
systemctl restart xinetd
systemctl enable xinetd
10. Login test
134 Host login 135 Host
[root@host-134 ~]# rsh host-135
Last login: Fri Jan 22 15:36:08 from host-134
[root@host-135 ~]#
135 Host login 134 Host
[root@host-135 ~]# rsh host-134
Last login: Fri Jan 22 14:05:29 from host-135
[root@host-134 ~]#
11. Transfer file test
Transfer the 134.txt file on the 134 host to the /root directory on the 135 host
rcp /root/134.txt host-135:/root
Verify on 135 host
[root@host-135 ~]# ls
134.txt
Transfer the sub-files and sub-directories in the test directory on the 135 host to the /root directory on the 135 host
rcp -r /root/test host-134:/root
verification:
[root@host-134 ~]# tree test/
test/
├── test_1
├── test1.txt
├── test_2
└── test2.txt
2 directories, 2 files