首页 » 操作系统 » Linux » 用root直接Telnet远程Linux服务器

用root直接Telnet远程Linux服务器

 

开启了Telnet命令远程Linux服务器后,发现不能用root用户直接登录,非root用户是可以的,这是因为Telnet远程Linux过程中,传输都是明文的,极不安全,所以Linux系统默认禁止root直接Telnet登录。

当然可以先用非root用户登录后,再用su root命令切换到root用户,但是总归有些不方便。

希望强制允许root通过Telnet连接Linux服务器,那也没问题,修改下面2个配置文件即可:

1、编辑/etc/pam.d/login文件,注释带pam_securetty.so的一行

[root@localhost /]# vi /etc/pam.d/login
#%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    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    required     pam_namespace.so
session    optional     pam_keyinit.so force revoke
session    include      system-auth
-session   optional     pam_ck_connector.so

2、编辑/etc/pam.d/remote文件,注释带pam_securetty.so的一行

[root@localhost /]# vi /etc/pam.d/remote
#%PAM-1.0
#auth       required     pam_securetty.so   \\前面加#号注释此行
auth       include      password-auth
account    required     pam_nologin.so
account    include      password-auth
password   include      password-auth
# pam_selinux.so close should be the first session rule
session    required     pam_selinux.so close
session    required     pam_loginuid.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    required     pam_namespace.so
session    optional     pam_keyinit.so force revoke
session    include      password-auth

现在Telnet尝试用root用户登录,发现已经可以正常登录了:
QQ截图20161122133214
怎么开启用Tlenet远程登录Linux服务器?这个还是百度吧,一大堆。

原文链接:用root直接Telnet远程Linux服务器,转载请注明来源!

3