RCP在目前来说可以算上古工具了,用于复制远程文件或目录,明文传输,数据包中直接显示命令,用户名称和文件内容,十分不安全,现在应该基本无人使用,大家都使用更加安全的方式来传输文件。我需要一个rcp命令传输文件时的数据包,但是没有相应PCAP和环境,就搭建了一个。过程记录如下:
先说一下环境: 局域网,同一网段下两台机器
OS:CentOS Linux release 7.4.1708 (Core)、CentOS Linux release 7.5.1804 (Core)
一、安装
1 | yum -y install rsh rsh-server xinetd |
二、修改两台机器下hosts文件
目的是为了将双方IP和hostname进行对应
1 | [root@localhost ~]# cat /etc/hosts |
1 | [root@localhost ~]# cat /etc/hosts |
三、在两台机器的根目录下创建.rhosts
文件,内容分别为:
1 | [root@localhost ~]# cat .rhosts |
1 | [root@localhost ~]# cat .rhosts |
四、分别在两台机器/etc/xinetd.d
目录内创建rlogin和rsh文件,写入文件内容并确保存在disable = no
rlogin:
1 | [root@localhost ~]# cat /etc/xinetd.d/rlogin |
rsh:
1 | [root@localhost ~]# cat /etc/xinetd.d/rsh |
五、在两台机器的/etc/securetty
文件中添加rexec、rsh、rlogin三行。
六、分别重启xinetd服务
1 | service xinetd restart |
或者
1 | /bin/systemctl restart xinetd.service |
七、查看两台机器的防火墙是否处于active状态
1 | [root@localhost ~]# systemctl status firewalld |
如果是,请务必将两台机器的防火墙关闭。
八、测试rlogin和rsh功能
1 | [root@localhost ~]# rlogin rcptwo |
九、使用rcp命令将rcpone中的文件复制到rcptwo中:
1 | rcp rcp_test/hh.txt rcptwo:/root/rcp_test/ |