centos 7 安装Telnet并设为开机自启动、开防火墙端口

博客主要记录了在 CentOS 7 系统中对 Telnet 服务的配置过程,包括查看 Telnet 相关软件包、设置服务开机自启、使用 systemctl 管理服务等操作,还涉及防火墙的配置,如查看开启的端口和服务、添加并永久开放 Telnet 服务等,最后进行了客户端验证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

[root@b ~]# rpm -qa | grep telnet
telnet-0.17-64.el7.x86_64
telnet-server-0.17-64.el7.x86_64
[root@b ~]# chkconfig --list | grep telnet

注:该输出结果只显示 SysV 服务,并不包含
原生 systemd 服务。SysV 配置数据
可能被原生 systemd 配置覆盖。

要列出 systemd 服务,请执行 'systemctl list-unit-files'。
查看在具体 target 启用的服务请执行
'systemctl list-dependencies [target]'。

[root@b ~]# systemctl list-unit
list-unit-files list-units
[root@b ~]# systemctl list-unit-files | grep telnet
telnet@.service static
telnet.socket disabled
[root@b ~]# systemctl start retelnet.socket
Failed to start retelnet.socket: Unit not found.
[root@b ~]# systemctl restart telnet.socket
[root@b ~]# systemctl enable telnet.socket
Created symlink from /etc/systemd/system/sockets.target.wants/telnet.socket to /usr/lib/systemd/system/telnet.socket.
[root@b ~]# systemctl list-unit-files | grep telnet
telnet@.service static
telnet.socket enabled
[root@b ~]# chkconfig telnet.socket on
服务 telnet.socket 信息读取出错:没有那个文件或目录
[root@b ~]# chkconfig sshd on                  #centos 7不在支持chkconfig方式设置开机自启动
注意:正在将请求转发到“systemctl enable sshd.service”。

 

[root@b ~]# firewall-cmd --list-services              #查看当前开启了哪些端口
dhcpv6-client ssh telnet
[root@b ~]# firewall-cmd --get-services              #查看还可以开启哪些服务
RH-Satellite-6 amanda-client amanda-k5-client bacula bacula-client bgp bitcoin b
itcoin-rpc bitcoin-testnet bitcoin-testnet-rpc ceph ceph-mon cfengine condor-col
lector ctdb dhcp dhcpv6 dhcpv6-client dns docker-registry docker-swarm dropbox-l
ansync elasticsearch freeipa-ldap freeipa-ldaps freeipa-replication freeipa-trus
t ftp ganglia-client ganglia-master git gre high-availability http https imap im
aps ipp ipp-client ipsec irc ircs iscsi-target jenkins kadmin kerberos kibana kl
ogin kpasswd kprop kshell ldap ldaps libvirt libvirt-tls managesieve mdns minidl
na mongodb mosh mountd ms-wbt mssql murmur mysql nfs nfs3 nmea-0183 nrpe ntp ope
nvpn ovirt-imageio ovirt-storageconsole ovirt-vmconsole pmcd pmproxy pmwebapi pm
webapis pop3 pop3s postgresql privoxy proxy-dhcp ptp pulseaudio puppetmaster qua
ssel radius redis rpc-bind rsh rsyncd samba samba-client sane sip sips smtp smtp
-submission smtps snmp snmptrap spideroak-lansync squid ssh syncthing syncthing-
gui synergy syslog syslog-tls telnet tftp tftp-client tinc tor-socks transmissio
n-client upnp-client vdsm vnc-server wbem-https xmpp-bosh xmpp-client xmpp-local
xmpp-server zabbix-agent zabbix-server
[root@b ~]# firewall-cmd --add-service=telnet            #添加需要通过防火墙的服务
Warning: ALREADY_ENABLED: 'telnet' already in 'public'
success
[root@b ~]# firewall-cmd --permanent --add-service=telnet      #永久开放一个服务,加上permanent,开启自动放行
Warning: ALREADY_ENABLED: telnet
success
[root@b ~]# firewall-cmd --reload                  #更新防火墙规则
success

 

windows客户端cmd验证:

 

服务器重启后,客户端验证正常。

 

转载于:https://www.cnblogs.com/xiaofeng666/p/10900873.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值