centos解决bash: telnet: command not found...&& telnet: connect to address 127.0.0.1: Connection refu...

检查telnet是否已安装:

 

[root@hostuser src]# rpm -q telnet-server
package telnet-server is not installed
[root@hostuser src]# telnet 192.168.81.129
bash: telnet: command not found...

 

rpm -qa |grep telnet

没有则安装,有跳过

 yum install telnet-server -y && yum install telnet.* -y

启动telnet 服务

[root@hostuser src]# sudo service xinetd restart
Redirecting to /bin/systemctl restart xinetd.service

确认启动telnet服务

[root@hostuser xinetd.d]# ps -ef | grep xinetd
root 33139 1 0 12:11 ? 00:00:00 /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
root 35218 30125 0 12:27 pts/0 00:00:00 grep --color=auto xinetd

尝试一下
[root@hostuser src]# telnet localhost
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
[root@hostuser src]# netstat -tnl |grep 23

没反应检查telnet默认端口23不在开通防火墙23端口

开放23端口

 firewall-cmd --zone=public --add-port=23/tcp --permanent

重启防火墙
firewall-cmd --reload
检查端口开启23情况

[root@hostuser xinetd.d]# firewall-cmd --zone=public --list-ports
8989/tcp 8686/tcp 40127/tcp 23/tcp

再尝试一下
[root@hostuser src]# telnet localhost
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused

 

检查 cd  /etc/xinetd.d

检查telnet文件存不存在,不存在touch telnet

vi /etc/xinetd.d/telnet

添加

#default:yes
# description: The telnet server servestelnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
    flags = REUSE
    socket_type  = stream
    wait = no
    user = root
    server =/usr/sbin/in.telnetd
    log_on_failure  += USERID
    disable = no
}

 若存在直接修改

    disable = no

然后重启 xinetd

[root@hostuser src]# sudo service xinetd restart
Redirecting to /bin/systemctl restart xinetd.service

设置xinetd开机自启动:

systemctl enable xinetd.service

检查telnet效果

[root@hostuser xinetd.d]# telnet localhost
Trying ::1...
Connected to localhost.
Escape character is '^]'.

Kernel 3.10.0-957.10.1.el7.x86_64 on an x86_64
hostuser login:

问题解决

 

转载于:https://www.cnblogs.com/SunshineKimi/p/10885392.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值