环境:centos7.7 IP:10.9.96.212
[root@study ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
[root@study ~]#
1.在安装Telnet前先检查系统是否安装了telnet-server和xinetd
[root@study ~]# rpm -qa telnet
[root@study ~]# rpm -qa telnet-server
[root@study ~]# rpm -qa xinetd
2.安装Telnet
[root@study ~]# yum -y install telnet
[root@study ~]# yum -y install telnet-server
[root@study ~]# yum -y install xinetd
3.安装完成后,将xinetd服务、telnet服务加入开机自启动
[root@study ~]#systemctl enable telnet.socket
[root@study ~]#systemctl start xinetd
telnet服务默认是不开启的,修改文件/etc/xinetd.conf来开启服务 ,把enabled 注释去掉,=号后面加yes
[root@study etc]# vim xinetd.conf
#
# This is the master xinetd configuration file. Settings in the
# default section will be inherited by all service configurations
# unless explicitly overridden in the service configuration. See
# xinetd.conf in the man pages for a more detailed explanation of
# these attributes.
defaults
{
# The next two items are intended to be a quick access place to
# temporarily enable or disable services.
#
enabled =yes
# disabled =
# Define general logging characteristics.
log_type = SYSLOG daemon info
log_on_failure = HOST
log_on_success = PID HOST DURATION EXIT
# Define access restriction defaults
#
# no_access =
# only_from =
# max_load = 0
cps = 50 10
instances = 50
per_source = 10
# Address and networking defaults
#
4.检查服务开启状态
[root@study ~]# systemctl status telnet.socket
● telnet.socket - Telnet Server Activation Socket
Loaded: loaded (/usr/lib/systemd/system/telnet.socket; enabled; vendor preset: disabled)
Active: active (listening) since 三 2019-09-18 21:31:27 CST; 13h ago
Docs: man:telnetd(8)
Listen: [::]:23 (Stream)
Accepted: 0; Connected: 0
9月 18 21:31:27 study.centos systemd[1]: Listening on Telnet Server Activation Socket.
[root@study ~]# systemctl status xinetd
● xinetd.service - Xinetd A Powerful Replacement For Inetd
Loaded: loaded (/usr/lib/systemd/system/xinetd.service; enabled; vendor preset: enabled)
Active: active (running) since 三 2019-09-18 21:31:36 CST; 13h ago
Main PID: 1085 (xinetd)
CGroup: /system.slice/xinetd.service
└─1085 /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
9月 18 21:31:37 study.centos xinetd[1085]: removing daytime
9月 18 21:31:37 study.centos xinetd[1085]: removing discard
9月 18 21:31:37 study.centos xinetd[1085]: removing discard
9月 18 21:31:37 study.centos xinetd[1085]: removing echo
9月 18 21:31:37 study.centos xinetd[1085]: removing echo
9月 18 21:31:37 study.centos xinetd[1085]: removing tcpmux
9月 18 21:31:37 study.centos xinetd[1085]: removing time
9月 18 21:31:37 study.centos xinetd[1085]: removing time
9月 18 21:31:37 study.centos xinetd[1085]: xinetd Version 2.3.15 started with libwrap loadavg labeled-networking options compiled in.
9月 18 21:31:37 study.centos xinetd[1085]: Started working: 0 available services
[root@study ~]#
5.关闭防火墙
[root@study ~]#systemctl stop firewalld.service //停止firewall
[root@study ~]#systemctl disable firewalld.service //禁止firewall开机启动
6.测试
[I:\~]$ telnet 10.9.96.212
Connecting to 10.9.96.212:23...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Kernel 3.10.0-1062.1.1.el7.x86_64 on an x86_64
study login: root
Password:
Last login: Thu Sep 19 10:50:49 from 10.9.96.224
[root@study ~]#