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

相关推荐
伟大无须多言2 分钟前
《深度掌控Linux:openEuler、CentOS、Debian、Ubuntu的全方位运维指南》
linux·运维·centos
腾昵猫41 分钟前
Linux从网卡接收到内核软中断处理整体流程
linux·运维·windows
ImangoCloud43 分钟前
Git的windows开发与linux开发配置
linux·windows·git
带鱼工作室1 小时前
conda更换清华源
linux·运维·conda
GIS数据转换器1 小时前
多旋翼无人机架空输电线路自动化巡检方案
运维·科技·安全·自动化·无人机·智慧城市·交互
鹏大师运维1 小时前
中科方德鸳鸯火锅平台使用教程:轻松运行Windows应用!
linux·windows·国产操作系统·统信uos·中科方德·麒麟2503·鸳鸯火锅
ARM2NCWU1 小时前
安卓原生兼容服务器
android·运维·服务器
shylyly_2 小时前
Linux环境基础开发工具->vim
linux·运维·编辑器·vim·centos 7·vim配置·底行模式
nihuhui6663 小时前
NFS服务器实验
运维·服务器
Johny_Zhao3 小时前
centos8安装部署RADIUS+MySQLPGSQL高可用架构实现
linux·网络·网络安全·信息安全·云计算·shell·cisco·yum源·radius·huawei·系统运维·华三