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
[email protected]                                                           static          -
telnet.socket                                                             disabled        disabled


root@www:/etc/yum.repos.d# systemctl status [email protected]
Failed to get properties: Unit name [email protected] 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

相关推荐
Arrtoria35 分钟前
Kernel2.X的内存世界
linux
wearegogog12335 分钟前
Docker Buildx 简介与安装指南
运维·docker·容器
程序员岳焱36 分钟前
Java 与 MySQL 性能优化:Linux服务器上MySQL性能指标解读与监控方法
linux·后端·mysql
Jooolin36 分钟前
【编程史】Ubuntu到底是啥?它和Linux又是什么关系?
linux·ubuntu·操作系统
苏州向日葵3 小时前
virtualBox安装ubuntu,常用知识点
linux·运维·ubuntu
夜光小兔纸3 小时前
SQL Server 修改数据库名及物理数据文件名
运维·数据库·sql server
阿福不是狗3 小时前
Python使用总结之Linux部署python3环境
linux·开发语言·python
张海森-1688203 小时前
基于sample_aiisp例子,创建3路编码流,记录
linux
yangzx的网工日常3 小时前
网络的那些事——初级——OSPF(1)
运维·服务器·网络
飞凌嵌入式4 小时前
基于RK3588,飞凌教育品牌推出嵌入式人工智能实验箱EDU-AIoT ELF 2
linux·人工智能·嵌入式硬件·arm·nxp