Telnet远程root登录CentOS

CentOS版本:CentOS Linux release 7.6.1810 (Core)

  1. 安装Telnet

    yum install -y telnet-server
    
  2. 安装xinetd

    yum install -y xinetd
    
  3. 启动服务

    systemctl start xinetd.service
    systemctl start telnet.socket
    
  4. 查看服务状态

    systemctl status xinetd.service
    systemctl status telnet.socket
    
  5. 修改安全文件,运行root登录

    vim /etc/securetty
    # 末尾追加下面两行
    pts/0
    pts/1
    
  6. 关闭防火墙和selinux

    systemctl stop firewalld
    setenforce 0
    
  7. 修改telnet权限,保障远程telnet可以使用root用户登录

    [root@ct1 ~]# cat /etc/pam.d/remote 
    #%PAM-1.0
    #auth       required     pam_securetty.so   # 注释这一行
    
  8. 修改telnet参数,保障客户端可以正常telnet到服务器

    # 如果没有这个文件,新建文件写入内容。
    [root@ct1 ~]# cat /etc/xinetd.d/telnet
    service telnet
    {
            flags = REUSE
            socket_type = stream
            wait = no
            user = root
            server = /usr/sbin/in.telnetd
            log_on_failure += USERID
            disable = no
    }
    
  9. 重启xinetd

    systemctl restart xinetd
    
  10. 用其它机器进行Telnet远程登录

原文地址:https://www.cnblogs.com/os-linux/p/15049452.html