平时在运维的时候,有时候SSH无法使用的情况下就需要备用telnet远程,本文就简单分享如何安装配置telnet远程
一、获取安装包
安装包需要准备telnettelnet-serverxintet,都是非常成熟的软件,可在线直接安装。
在线安装:
yum install telnet telnet-server xinetd -y
离线安装:先在有外网电脑缓存安装包、路径在/home/telnet下
yum install telnet telnet-server xinetd --downloadonly --downloaddir=/home/telnet
二、关闭防火墙和selinux
#关闭防火墙和selinux systemctl stop firewalld.service systemctl disable firewalld.service setenforce 0 sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config sestatus
三、启动服务
#启动服务
systemctl start telnet.socket
systemctl start xinetd
systemctl status telnet.socket
systemctl status xinetd
systemctl enable telnet.socket
systemctl enable xinetd
四、添加终端允许、不然远程会被拦截
#这里可信终端可以多添加一些 echo 'pts/0' >>/etc/securetty echo 'pts/1' >>/etc/securetty echo 'pts/20' >>/etc/securetty #重启服务 systemctl restart telnet.socket systemctl restart xinetd systemctl status telnet.socket systemctl status xinetd
五、测试连接、打印日志
#如果报错,打印日志
tail -f /var/log/secure