温馨提示×

CentOS下Telnet服务如何启动与停止

小樊
43
2026-01-03 23:06:56
栏目: 智能运维

在CentOS系统中,Telnet服务的启动和停止可以通过以下步骤进行:

启动Telnet服务

  1. 使用systemctl命令启动Telnet服务

    sudo systemctl start telnet.socket
    

    或者,如果你使用的是较旧的系统版本,可能需要使用以下命令:

    sudo service xinetd restart
    
  2. 检查Telnet服务状态

    sudo systemctl status telnet.socket
    

    或者:

    sudo service xinetd status
    

停止Telnet服务

  1. 使用systemctl命令停止Telnet服务

    sudo systemctl stop telnet.socket
    

    或者:

    sudo service xinetd stop
    
  2. 禁用Telnet服务(防止开机自启)

    sudo systemctl disable telnet.socket
    

    或者:

    sudo systemctl disable xinetd
    

配置防火墙

如果你使用的是firewalld作为防火墙管理工具,还需要确保防火墙允许Telnet流量。可以使用以下命令开放Telnet端口(默认端口为23):

sudo firewall-cmd --permanent --add-port=23/tcp
sudo firewall-cmd --reload

注意事项

  • Telnet协议不安全,因为它在传输数据时不加密。建议在生产环境中使用更安全的SSH协议。
  • 如果你禁用了Telnet服务,确保你有其他远程管理工具(如SSH)可用。

通过以上步骤,你可以在CentOS系统中启动和停止Telnet服务,并进行相应的配置。

0