rlogin - 512/513/514 - without password

rlogin简介

远程登录(rlogin)是一个UNIX命令,它允许授权用户进入网络中的其它UNIX机器并且就像用户在现场操作一样。一旦进入主机,用户可以操作主机允许的任何事情,比如:读文件、编辑文件或删除文件等。Rlogin:远程登录命令rloginRemoteLogin in Unix systems


实验环境

root@linux:~# uname -a
Linux linux 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux


安装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).

配置rshrlogin,允许远程登录,无需密码验证.

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.
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这些命令用于查看和检查系统的配置和日志文件。以下是每个命令的简要说明: 1. `cat /etc/pam.d/system-auth`: 显示 `/etc/pam.d/system-auth` 文件的内容,该文件用于管理系统级身份验证和授权。 2. `cat /etc/pam.d/sshd`: 显示 `/etc/pam.d/sshd` 文件的内容,该文件用于管理 SSH 服务的身份验证和授权。 3. `cat /etc/profile`: 显示 `/etc/profile` 文件的内容,该文件是一个全局配置文件,用于设置用户环境变量和执行系统级别的脚本。 4. `cat /etc/passwd`: 显示 `/etc/passwd` 文件的内容,该文件包含了系统中所有用户的基本信息,但不包含密码。 5. `cat /etc/shadow`: 显示 `/etc/shadow` 文件的内容,该文件包含了系统中用户的加密密码。 6. `cat /etc/group`: 显示 `/etc/group` 文件的内容,该文件包含了系统中用户组的信息。 7. `cat /etc/hosts.equiv`: 显示 `/etc/hosts.equiv` 文件的内容,该文件用于定义可信任主机列表,允许这些主机使用 rsh 或 rlogin 进行远程登录。 8. `cat /etc/hosts.rhosts`: 显示 `/etc/hosts.rhosts` 文件的内容,该文件用于定义远程主机和用户之间的信任关系。 9. `ps aux | grep telnet`: 列出所有正在运行的进程,并过滤出包含 "telnet" 关键字的进程。 10. `ps aux | grep rlogin`: 列出所有正在运行的进程,并过滤出包含 "rlogin" 关键字的进程。 11. `ps aux | grep ftp`: 列出所有正在运行的进程,并过滤出包含 "ftp" 关键字的进程。 12. `cat /etc/ssh/sshd_config`: 显示 `/etc/ssh/sshd_config` 文件的内容,该文件包含了 SSH 服务器的配置选项。 13. `umask`: 显示当前用户的默认文件权限掩码。 14. `ls -l /etc/passwd`: 显示 `/etc/passwd` 文件的详细信息,包括权限、所有者和修改时间等。 15. `ls -l /etc/group`: 显示 `/etc/group` 文件的详细信息,包括权限、所有者和修改时间等。 16. `ls -l /etc/shadow`: 显示 `/etc/shadow` 文件的详细信息,包括权限、所有者和修改时间等。 17. `ls -l /etc/xinetd.conf`: 显示 `/etc/xinetd.conf` 文件的详细信息,该文件是 xinetd 服务的配置文件。 18. `ls -l /etc/sudoers`: 显示 `/etc/sudoers` 文件的详细信息,该文件用于配置 sudo 命令的权限。 19. `ls -l /etc/httpd.conf`: 显示 `/etc/httpd.conf` 或 `/etc/apache2/apache2.conf` 文件的详细信息,这些文件是 Apache HTTP 服务器的配置文件。 20. `ls -l /etc/httpd-mpm.conf`: 显示 `/etc/httpd-mpm.conf` 文件的详细信息,该文件定义了 Apache MPM(多处理模块)的配置选项。 21. `ls -l /etc/conf/tomcat-users.xml`: 显示 `/etc/conf/tomcat-users.xml` 文件的详细信息,该文件包含了 Tomcat 服务器的用户配置。 22. `ls -l /etc/conf/web.xml`: 显示 `/etc/conf/web.xml` 文件的详细信息,该文件是 Java Web 应用程序的配置文件。 23. `ls -l /etc/conf/server.xml`: 显示 `/etc/conf/server.xml` 文件的详细信息,该文件是 Tomcat 服务器的主配置文件。 24. `ls -l /etc/my.cnf`: 显示 `/etc/my.cnf` 或 `/etc/mysql/my.cnf` 文件的详细信息,这些文件是 MySQL 数据库服务器的配置文件。 25. `ls -l /var/mysqllog/logbin.log`: 显示 `/var/mysqllog/logbin.log` 文件的详细信息,该文件是 MySQL 数据库二进制日志的位置。 26. `ps aux | grep syslogd`: 列出所有正在运行的进程,并过滤出包含 "syslogd" 关键字的进程。 27. `ps aux | grep rsyslogd`: 列出所有正在运行的进程,并过滤出包含 "rsyslogd" 关键字的进程。 28. `service syslog status`: 显示 syslog 服务的状态。 29. `service rsyslog status`: 显示 rsyslog 服务的状态。 30. `ps aux | grep audit`: 列出所有正在运行的进程,并过滤出包含 "audit" 关键字的进程。 31. `service auditd status`: 显示 auditd 服务的状态。 32. `ps aux | grep ssh`: 列出所有正在运行的进程,并过滤出包含 "ssh" 关键字的进程。 33. `ls -l /var/log/messages`: 显示 `/var/log/messages` 文件的详细信息,该文件包含了系统的一般日志消息。 34. `ls -l /var/log/secure`: 显示 `/var/log/secure` 文件的详细信息,该文件包含了安全相关的日志消息。 35. `ls -l /var/log/audit/audit.log`: 显示 `/var/log/audit/audit.log` 文件的详细信息,该文件包含了审计日志。 36. `tail -20 /var/log/messages`: 显示 `/var/log/messages` 文件的尾部 20 行内容。 37. `tail -20 /var/log/audit/audit.log`: 显示 `/var/log/audit/audit.log` 文件的尾部 20 行内容。 38. `tail -n 20 /var/log/messages`: 显示 `/var/log/messages` 文件的尾部 20 行内容。 39. `tail -n 20 /var/log/audit/audit.log`: 显示 `/var/log/audit/audit.log` 文件的尾部 20 行内容。 40. `cat /etc/logrotate.conf`: 显示 `/etc/logrotate.conf` 文件的内容,该文件用于配置日志文件的轮转。 41. `cat /etc/rsyslog.conf`: 显示 `/etc/rsyslog.conf` 文件的内容,该文件是 rsyslog 服务的配置文件。 42. `auditctl -s`: 显示当前系统上启用的审计规则。 43. `auditctl -l`: 列出当前系统上的所有审计规则。 44. `lsof -i:21`: 列出所有正在使用端口 21(FTP)的进程和文件。 45. `lsof -i:22`: 列出所有正在使用端口 22(SSH)的进程和文件。 46. `lsof -i:23`: 列出所有正在使用端口 23(Telnet)的进程和文件。 请注意,某些命令可能需要管理员权限才能运行,且需要小心处理敏感信息。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值