在Redhat5中开通Root远程登录详解(Telnet)
telnet:提供telnet服务,使用未加密的用户/密码组进行验证,依附于xinetd服务。文件位于/etc/xinetd.d/telnet。
ekrb5-telnet:提供加密的telnet服务,但是必须要ekrb5的加密服务器。文件位于/etc/xinetd.d/ekrb5-telnet。
1、查看telnet rpm包
|
|
注:安装完毕以后会在/etc/xinetd.d/中出现一个telnet配置文件
1、查看telnet服务
|
|
|
四、telnet服务调试
1、配置telnet文件
# default: on
# description: The telnet server serves telnet sessions; it uses / # unencrypted username/password pairs for authentication. service telnet { disable = no 《=确认是no flags = REUSE socket_type = stream wait = no user = root server = /usr/sbin/in.telnetd log_on_failure += USERID } |
2、注意/etc/xinetd.d/ekrb5-telnet 和 krb5-telnet两个文件中的disable,稍后说明其作用。
五、telnet开启root
1、确认/etc/pam.d/login中的pam_securetty.so行,并将其注释掉"#"
#%PAM-1.0
#auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so auth include system-auth account required pam_nologin.so account include system-auth password include system-auth # pam_selinux.so close should be the first session rule session required pam_selinux.so close session include system-auth session required pam_loginuid.so session optional pam_console.so # pam_selinux.so open should only be followed by sessions to be executed in the user context session required pam_selinux.so open session optional pam_keyinit.so force revoke |
|
因为telnet服务是由xinetd调用,所以只要重新启动xinetd即可
|
C:/>telnet 192.168.238.220
正在连接192.168.238.220... Red Hat Enterprise Linux Server release 5 (Tikanga) Kernel 2.6.18-8.el5 on an i686 login: root Password: Last login: Sat Aug 1 22:47:15 from 192.168.238.1 [root@rhel52 ~]# |
八、telnet端口更改
设定配置文件/etc/services
|
设定配置文件/etc/xinetd.d/telnet
access_time = 20:00-24:00
# default: on # description: The telnet server serves telnet sessions; it uses / # unencrypted username/password pairs for authentication. service telnet { disable = no flags = REUSE socket_type = stream wait = no user = root server = /usr/sbin/in.telnetd log_on_failure += USERID only_from = 192.168.0.0/16 } #bind = 192.168.0.100
#only_from = 192.168.0.0/24 #no_access = 192.168.0.{80,90} #access_times = 8:00-9:00 20:00-23:00 |
十、配置文件krb5-telnet
文件所在位置 /etc/xinetd.d/krb5-telnet
其实rhel5已经装了krb5-telnet,那么就可以启用这个服务来达到开启telnet的目的。不用再安装telnet-server这个软件包了。可以使用Kerberos 5来进行认证。
|
2、启动服务
|
文件所在位置 /etc/xinetd.d/ekrb5-telnet
ekrb5- telnet可以用来提供加密的telnet服务。如果启用了ekrb5-telnet服务,但是又没有Kerberos服务器的话,那么在进行 telnet登录时,总是会报“Unencrypted connection refused. Goodbye.(未加密的连接,拒绝服务)”这个错误。
1、开启ekrb5-telnet服务。
|
2、启动服务
|
十二、telnet登陆错误解析
①错误信息:
|
当出现如上信息时,请检查/etc/xinetd.d/krb5-telnet,并将“disable = no”改成yes
|
|
# default: off
# description: The kerberized telnet server accepts only telnet sessions, / # which use Kerberos 5 authentication and encryption. service telnet { flags = REUSE socket_type = stream wait = no user = root server = /usr/kerberos/sbin/telnetd server_args = -e log_on_failure += USERID disable = no <- no改成yes }
|
|
# Do not remove the following line, or various programs
# that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost rhel52 #::1 rhel52 localhost6 192.168.238.220 rhel52 192.168.0.100 win-gk18e84nu08 |