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

相关推荐
无敌暴龙兽z3 小时前
离线环境安装elk及设置密码认证
运维·elk
M4K03 小时前
Linux百度网盘优化三板斧
linux
好奇的菜鸟3 小时前
如何在 Ubuntu 24.04 (Noble) 上使用阿里源
linux·运维·ubuntu
bcbobo21cn3 小时前
初步了解Linux etc/profile文件
linux·运维·服务器·shell·profile
wayuncn4 小时前
月付物理服务器租用平台-青蛙云
运维·服务器·服务器租用·服务器托管·物理机租用
望获linux4 小时前
【实时Linux实战系列】CPU 隔离与屏蔽技术
java·linux·运维·服务器·操作系统·开源软件·嵌入式软件
0wioiw04 小时前
C#基础(项目结构和编译运行)
linux·运维·服务器
2401_873587825 小时前
Linux常见指令以及权限理解
linux·运维·服务器
RW~5 小时前
Minio安装配置,桶权限设置,nginx代理 https minio
运维·nginx·https·minio
Arthurmoo5 小时前
Linux系统之MySQL数据库基础
linux·数据库·mysql