rlogin简介 |
远程登录(rlogin)是一个UNIX命令,它允许授权用户进入网络中的其它UNIX机器并且就像用户在现场操作一样。一旦进入主机,用户可以操作主机允许的任何事情,比如:读文件、编辑文件或删除文件等。Rlogin:远程登录命令rlogin:RemoteLogin in Unix systems |
实验环境 |
root@linux:~# uname -a |
安装rlogin程序前,请自行安装xinetd |
root@linux:~# apt-get install rsh-server rsh-client Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: rsh-client rsh-server 0 upgraded, 2 newly installed, 0 to remove and 16 not upgraded. Need to get 73.0 kB of archives. After this operation, 319 kB of additional disk space will be used. Get:1 http://http.debian.net/debian/ wheezy/main rsh-client amd64 0.17-15 [33.9 kB] Get:2 http://http.debian.net/debian/ wheezy/main rsh-server amd64 0.17-15 [39.1 kB] Fetched 73.0 kB in 4s (17.9 kB/s) Selecting previously unselected package rsh-client. (Reading database ... 115854 files and directories currently installed.) Unpacking rsh-client (from .../rsh-client_0.17-15_amd64.deb) ... Selecting previously unselected package rsh-server. Unpacking rsh-server (from .../rsh-server_0.17-15_amd64.deb) ... Processing triggers for man-db ... Setting up rsh-client (0.17-15) ... update-alternatives: using /usr/bin/netkit-rcp to provide /usr/bin/rcp (rcp) in auto mode update-alternatives: using /usr/bin/netkit-rsh to provide /usr/bin/rsh (rsh) in auto mode update-alternatives: using /usr/bin/netkit-rlogin to provide /usr/bin/rlogin (rlogin) in auto mode Setting up rsh-server (0.17-15) ... Installing new version of config file /etc/pam.d/rlogin ... Installing new version of config file /etc/pam.d/rsh ... Note: xinetd currently is not fully supported by update-inetd. Please consult /usr/share/doc/xinetd/README.Debian and itox(8). Note: xinetd currently is not fully supported by update-inetd. Please consult /usr/share/doc/xinetd/README.Debian and itox(8). Note: xinetd currently is not fully supported by update-inetd. Please consult /usr/share/doc/xinetd/README.Debian and itox(8). |
配置rsh,rlogin,允许远程登录,无需密码验证. |
vim /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 } service login { socket_type = stream wait = no user = root # log_on_success += USERID # log_on_failure += USERID server = /usr/sbin/in.rlogind disable = no } |
修改配置文件/etc/pam.d/rlogin,将pam_rhosts.so放在pam.securetty.so前面 |
#%PAM-1.0 #auth required pam_securetty.so auth sufficient pam_rhosts.so auth required pam_securetty.so @include common-auth @include common-account @include common-session @include common-password |
添加允许登录的主机,修改文件/root/.rhosts,/etc/hosts,/etc/hosts.equiv |
root@linux:~# cat /root/.rhosts + + |
root@linux:~# cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 linux 192.168.1.109 gnu # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters |
root@linux:~# cat /etc/hosts.equiv # /etc/hosts.equiv: list of hosts and users that are granted "trusted" r # command access to your system . + + |
登录rlogin |
root@gnu:~# rlogin -l root 192.168.1.112 Last login: Sat Sep 6 14:05:44 EDT 2014 from gnu on pts/2 Linux linux 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. root@linux:~# uname -a Linux linux 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux |
注:
如果rlogin -l root 登录,出现rlogind: Host address mismatch. 错误
请将客户机IP和计算机名,加入/etc/hosts.
测试环境,请下载metasploitable2.