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'安装一下先;

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 查询服务状态,并启动服务


###查询服务状态

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 呢?

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

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值