linux 配置telnet 连接(CentOS 7)

背景: 因为安全问题需要升级openssh 服务等,为了保险起见在更新过程中需要先设置telnetl连接已防更新失败后服务器不能连接

1、下载 telnet telnet-server xinetd (需要配置好yum 原)

yum -y install telnet telnet-server xinetd

2、注释 /etc/pam.d/login ( pam_securetty.so 行)

root@localhost ~]# head /etc/pam.d/login

#%PAM-1.0

#auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so

auth substack system-auth
auth include postlogin
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

3、移除/etc/securetty 文件
mv /etc/securetty /etc/securetty.bak

4、设置服务开机自启
systemctl start telnet.socket xinetd.service
systemctl enable telnet.socket xinetd.service

测试连接可以用:

telnet 10.x.x.x 23 (再输入密码看是否可以连接)

发表评论

电子邮件地址不会被公开。 必填项已用*标注