telnet不能用!!!提示:-bash: telnet: command not found

本文详细介绍了如何解决Telnet服务不可用的情况,包括检查安装状态、配置文件修改、服务重启及防火墙设置等步骤。

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

telnet不能用!!!提示:-bash: telnet: command not found

telnet不能用!!!提示:-bash: telnet: command not found
一.检查
1、[root@localhost ~]# telnet 
bash: telnet: command not found 
2、 查询了是否安装Telnet包,结果如下: 
[root@localhost ~]# rpm -qa telnet* 
telnet-server-0.17-47.el6.i686 
3、又查询了xinetd的状态: 
[root@localhost ~]# service xinetd status 
xinetd (pid 2967) 正在运行... 
4、使用ntsysv命令,开启了Telnet服务;同时,也查看 /etc/xinetd.d/telnet 文件,将将“disable = yes” 改为“disable = no”;也重启了服务 [root@CentOS5 /]#service xinetd restart 
在系统服务里面,也查看过,telnet服务和xinetd也都是工作状态。 
二.安装服务
解决方式,重装一下telnet客户端。 
centos、ubuntu 
yum list telnet* 查看telnet相关的安装包 
yum install telnet-server 安装telnet服务 
yum install telnet.* 安装telnet客户端

注意,安装之前要先安装#yum install xinetd (注意在root下安装)因为,telnet要依靠xinetd服务启动,所以要先安装该服务
三.配置telnet 
方法一:使用ntsysv,在出现的窗口之中,将 telnet 勾选起来,然后按下 OK 即可! 
方法二:使用chkconfig命令直接开启 
#chkconfig telnet on 
方法三:直接修改配置文件 
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 = yes 

只需要将”disable= yes”改成” disable=no” 
四、激活服务 
telnet 是挂在 xinetd 底下的,所以自然只要重新激活 xinetd 就能够将 xinetd 里头的设定重新读进来,所以刚刚设定的 telnet 自然 
也就可以被激活。 
  # servicexinetd restart 
或者#/etc/rc.d/init.d/xinetd restart 
五.iptables防火墙会阻止telnet,所以需要在iptables允许,用如下命令 
当你启动telnet服务后,你可以用netstat –tunlp命令来查看telnet服务所使用的端口,可以发现有23。使用下面命令开启这些端口: 
iptables -I INPUT -p tcp --dport 23 -jACCEPT 
iptables -I INPUT -p udp --dport 23 -jACCEPT 
service iptables save //保存 
service iptables restart //重启防火墙 
或者来点狠的!!关闭防火墙! 
service iptables stop 
六、可能的问题: 
下面我们来看一下二种错误: 
第一种: 
[root@linuxchao ~]# telnet 192.168.1.87 
Trying 192.168.1.87... 
telnet: connect to address 192.168.1.87: Noroute to host 
telnet: Unable to connect to remote host:No route to host 
解决方法:这种问题防火墙没有允许telnet服务,连接被阻止,默认CentOS只允许SSH,所以进入其自定义选项,在telnet前打个勾! 
第二种 :
[root@test xinetd.d]# telnet 172.25.1.3 
Trying 172.25.1.3... 
Connected to 172.25.1.3 (172.25.1.3). 
Escape character is '^]'. 
getnameinfo: localhost: Success 
Temporary failure in name resolution: Illegal seek 
Connection closed by foreign host. 
这一个就是/etc/hosts文件配置问题 
解决方法:我在里面加两个IP地址,内容如下: 
[linux@localhost ~]$ more /etc/hosts 
# Do not remove the following line, orvarious programs 
# that require network functionality willfail. 
127.0.0.1localhost.localdomainlocalhost 
::1localhost6.localdomain6localhost6 
192.168.1.88 
192.168.1.86 
说明:因为客户机的名字不好记就没写进去,内容格式应为127.0.0.1 pcname
-: command not found volumes:: command not found -: command not found root@srv771551:~# ports: - "新主机端口:容器端口" # 例如 - "8888:8080" ports:: command not found -: command not found root@srv771551:~# environment: MYSQL_USER: custom_user MYSQL_PASSWORD: custom_pass environment:: command not found MYSQL_USER:: command not found MYSQL_PASSWORD:: command not found root@srv771551:~# deploy: resources: limits: cpus: '2.0' memory: 2G deploy:: command not found resources:: command not found limits:: command not found cpus:: command not found memory:: command not found root@srv771551:~# environment: - APP_LOG_LEVEL=DEBUG # 添加日志级别 - SPRING_PROFILES_ACTIVE=prod # 指定 Spring 环境 environment:: command not found -: command not found -: command not found root@srv771551:~# docker-compose down # 停止旧容器 docker-compose up -d --build # 重建并启动 no configuration file provided: not found no configuration file provided: not found root@srv771551:~# # 检查环境变量 docker exec jeecg-boot printenv | grep DATABASE # 检查端口映射 docker ps --format "table {{.Names}}\t{{.Ports}}" Error response from daemon: No such container: jeecg-boot NAMES PORTS root@srv771551:~# .env 文件 (全局变量) ↓ docker-compose.yml (服务定义) ↓ ├─ Dockerfile (应用构建) └─ 应用配置文件 (如 application.yml) -bash: syntax error near unexpected token `(' ↓: command not found -bash: syntax error near unexpected token `$'\346\234\215\345\212\241\345\256\232\344\271\211'' ↓: command not found -bash: syntax error near unexpected token `(' -bash: syntax error near unexpected token `(' root@srv771551:~#
最新发布
07-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值