CentOS 10:启动telnet服务

参考,

鳥哥私房菜 - 第七章、網路安全與主機基本防護:限制埠口, 網路升級與 SELinux

7.3.3 埠口与服务的启动/关闭及开机时状态设定

我们知道系统的 Telnet 服务通常是以 super daemon 来控管的,请您启动您系统的 telnet 试看看。

1 要启动 telnet 首先必须要已经安装了 telnet 的服务器才行,所以请先以 rpm 查询看看是否有安装 telnet-server 呢? 『rpm -qa | grep telnet-server'如果没有安装的话,请利用原版光盘来安装,或者使用'yum install telnet-server'安装一下先;

bash 复制代码
root@www:/etc/yum.repos.d# rpm -qa |grep telnet
<===发现本机没有安装telnet

##安装该软件
root@www:/etc/yum.repos.d# yum install telnet-server
上次元数据过期检查:0:13:37 前,执行于 2025年05月21日 星期三 16时37分46秒。
依赖关系解决。
==============================================================================================================================================================
 软件包                                 架构                            版本                                       仓库                                  大小
==============================================================================================================================================================
安装:
 telnet-server                          x86_64                          1:0.17-94.el10                             TCappstream                           38 k

事务概要
==============================================================================================================================================================
安装  1 软件包

总下载:38 k
安装大小:54 k
确定吗?[y/N]: y
下载软件包:
telnet-server-0.17-94.el10.x86_64.rpm                                                                                          33 kB/s |  38 kB     00:01    
--------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                           33 kB/s |  38 kB     00:01     
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                                                               1/1 
  安装    : telnet-server-1:0.17-94.el10.x86_64                                                                                                           1/1 
  运行脚本: telnet-server-1:0.17-94.el10.x86_64                                                                                                           1/1 

已安装:
  telnet-server-1:0.17-94.el10.x86_64                                                                                                                         

完毕!

###查询到软件已安装
root@www:/etc/yum.repos.d# rpm -qa|grep telnet-server
telnet-server-0.17-94.el10.x86_64
root@www:/etc/yum.repos.d# yum info telnet-server
上次元数据过期检查:0:14:11 前,执行于 2025年05月21日 星期三 16时37分46秒。
已安装的软件包
名称         : telnet-server
时期         : 1
版本         : 0.17
发布         : 94.el10
架构         : x86_64
大小         : 54 k
源           : telnet-0.17-94.el10.src.rpm
仓库         : @System
来自仓库     : TCappstream
概况         : The server program for the Telnet remote login protocol
URL          : http://web.archive.org/web/20070819111735/www.hcs.harvard.edu/~dholland/computers/old-netkit.html
协议         : BSD-3-Clause AND BSD-4-Clause AND BSD-4-Clause-UC
描述         : Telnet is a popular protocol for logging into remote systems over the
             : Internet. The package includes a daemon that supports Telnet remote
             : logins into the host machine. The daemon is disabled by default.
             : You may enable the daemon by editing /etc/xinetd.d/telnet

2 查询服务状态,并启动服务

bash 复制代码
###查询服务状态

root@www:/etc/yum.repos.d# systemctl list-unit-files|grep telnet
telnet@.service                                                           static          -
telnet.socket                                                             disabled        disabled


root@www:/etc/yum.repos.d# systemctl status telnet@.service
Failed to get properties: Unit name telnet@.service is neither a valid invocation ID nor unit name.
root@www:/etc/yum.repos.d# systemctl status telnet.socket
○ telnet.socket - Telnet Server Activation Socket
     Loaded: loaded (/usr/lib/systemd/system/telnet.socket; disabled; preset: disabled)
     Active: inactive (dead)
       Docs: man:telnetd(8)
     Listen: [::]:23 (Stream)
   Accepted: 0; Connected: 0;

###启动服务
root@www:/etc/yum.repos.d# systemctl start telnet.socket

###软件服务已经启动了
root@www:/etc/yum.repos.d# systemctl status telnet.socket
● telnet.socket - Telnet Server Activation Socket
     Loaded: loaded (/usr/lib/systemd/system/telnet.socket; disabled; preset: disabled)
     Active: active (listening) since Wed 2025-05-21 16:53:47 CST; 1s ago
 Invocation: 0c194d99f5884f2295db2d68cff3f3ab
       Docs: man:telnetd(8)
     Listen: [::]:23 (Stream)
   Accepted: 0; Connected: 0;
      Tasks: 0 (limit: 200560)
     Memory: 8K (peak: 256K)
        CPU: 944us
     CGroup: /system.slice/telnet.socket

5月 21 16:53:47 www.cici.titi systemd[1]: Listening on telnet.socket - Telnet Server Activation Socket.

###查询验证1 
root@www:/etc/yum.repos.d# systemctl --state=loaded,active,listening --type=socket|grep telnet
  telnet.socket                           loaded active   listening Telnet Server Activation Socket

###查询验证2
root@www:/etc/yum.repos.d# systemctl status telnet.socket --state=loaded,active,listening --type=socket 
● telnet.socket - Telnet Server Activation Socket
     Loaded: loaded (/usr/lib/systemd/system/telnet.socket; disabled; preset: disabled)
     Active: active (listening) since Wed 2025-05-21 16:53:47 CST; 1 day 3h ago
 Invocation: 0c194d99f5884f2295db2d68cff3f3ab
       Docs: man:telnetd(8)
     Listen: [::]:23 (Stream)
   Accepted: 0; Connected: 0;
      Tasks: 0 (limit: 200560)
     Memory: 8K (peak: 256K)
        CPU: 944us
     CGroup: /system.slice/telnet.socket

5月 21 16:53:47 www.cici.titi systemd[1]: Listening on telnet.socket - Telnet Server Activation Socket.

###查询验证3
root@www:/etc/yum.repos.d# systemctl list-units telnet.socket
  UNIT          LOAD   ACTIVE SUB       DESCRIPTION                    
  telnet.socket loaded active listening Telnet Server Activation Socket

Legend: LOAD   → Reflects whether the unit definition was properly loaded.
        ACTIVE → The high-level unit activation state, i.e. generalization of SUB.
        SUB    → The low-level unit activation state, values depend on unit type.

1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

###查询验证4
root@www:/etc/yum.repos.d# systemctl list-units |grep telnet
  telnet.socket                                                                                              loaded active listening Telnet Server Activation Socket

3 利用 netstat -tnlp 察看是否有啟動 port 23 呢?

bash 复制代码
###已启动
root@www:/etc/yum.repos.d# netstat -tnlp |grep 23
tcp6       0      0 :::23                   :::*                    LISTEN      1/systemd 

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

相关推荐
NamoAmitabha1286 小时前
libpng12-0 1.2.54-1ubuntu1.1 (amd64 binary) in ubuntu xenial
linux·ubuntu20.4
Madison-No77 小时前
搭建项目测试环境
linux·运维·服务器·python
吴声子夜歌7 小时前
Shell编程实例——编写安全的shell脚本(二)
linux·运维·shell
悠悠121388 小时前
微服务通信别只看性能:REST 与 gRPC 的 6 个选型判断和一次 502 故障复盘
运维·服务器
xiaoye-duck9 小时前
《Linux 网络编程》深入理解 IP 协议(二):网段划分、私有 IP 与 NAT 地址转换
linux·网络·ip
zx_7414848110 小时前
【Linux入门】Shell 函数、正则表达式与文本处理:cut 与 awk
linux·运维·正则表达式
Zenova EdgeOS10 小时前
Linux dmesg 工业边缘实战:内核日志过滤、持久化与故障定位
linux·运维·边缘计算·工业边缘·dmesg·内核日志
金士顿10 小时前
System.Text.Json Source Generator 深度解析:为什么 Native AOT 不喜欢反射
linux·asp.net core·arm64·net·native aot
wdfk_prog11 小时前
ROS教程08:从 TransportTCP::connect() 追到 TCPROS Connection Header、序列化与 Socket 数据传输
运维·缓存·docker·容器·ros
做运维的阿瑞11 小时前
Python 标准库汇总:分类速览与常用模块清单
linux·运维·python