Linux-command not found问题

news/2024/8/22 16:42:28 标签: linux, 服务器, 运维

一、telnet命令

1.检查telnet是否有安装

#有输出说明已安装,如果没有输出则没有安装

rpm -qa telnet

#安装telnet

yum install -y telnet

#执行检查命令
[root@localhost ~]# rpm -qa telnet
[root@localhost ~]# 

#安装telnet
[root@localhost ~]# yum install -y telnet
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
Resolving Dependencies
--> Running transaction check
---> Package telnet.x86_64 1:0.17-66.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================
 Package                                         Arch                                            Version                                                  Repository                                        Size
=================================================================================================================================================================================================================
Installing:
 telnet                                          x86_64                                          1:0.17-66.el7                                            updates                                           64 k

Transaction Summary
=================================================================================================================================================================================================================
Install  1 Package

Total download size: 64 k
Installed size: 113 k
Downloading packages:
warning: /var/cache/yum/x86_64/7/updates/packages/telnet-0.17-66.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY                                        ]  0.0 B/s |    0 B  --:--:-- ETA 
Public key for telnet-0.17-66.el7.x86_64.rpm is not installed
telnet-0.17-66.el7.x86_64.rpm                                                                                                                                                             |  64 kB  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-6.1810.2.el7.centos.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:telnet-0.17-66.el7.x86_64                                                                                                                                                                   1/1 
  Verifying  : 1:telnet-0.17-66.el7.x86_64                                                                                                                                                                   1/1 

Installed:
  telnet.x86_64 1:0.17-66.el7                                                                                                                                                                                    

Complete!
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 


#检查是否安装成功
[root@localhost ~]# rpm -qa telnet
telnet-0.17-66.el7.x86_64
[root@localhost ~]# 

2.检查telnet-server服务是否安装

#有输出说明已安装,如果没有输出则没有安装

rpm -qa telnet-server

#安装telnet

yum install -y telnet-server

#检查telcet-server是否安装

[root@localhost ~]# rpm -qa telnet-server
[root@localhost ~]# 
[root@localhost ~]# 

#安装telnet-server
[root@localhost ~]# yum install -y telnet-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
Resolving Dependencies
--> Running transaction check
---> Package telnet-server.x86_64 1:0.17-66.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================
 Package                                              Arch                                          Version                                                 Repository                                      Size
=================================================================================================================================================================================================================
Installing:
 telnet-server                                        x86_64                                        1:0.17-66.el7                                           updates                                         41 k

Transaction Summary
=================================================================================================================================================================================================================
Install  1 Package

Total download size: 41 k
Installed size: 55 k
Downloading packages:
telnet-server-0.17-66.el7.x86_64.rpm                                                                                                                                                      |  41 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:telnet-server-0.17-66.el7.x86_64                                                                                                                                                            1/1 
  Verifying  : 1:telnet-server-0.17-66.el7.x86_64                                                                                                                                                            1/1 

Installed:
  telnet-server.x86_64 1:0.17-66.el7                                                                                                                                                                             

Complete!
[root@localhost ~]# 
[root@localhost ~]# 


#检查telnet是否安装
[root@localhost ~]# rpm -qa telnet-server
telnet-server-0.17-66.el7.x86_64
[root@localhost ~]# 

3.如果进行了telnet-server安装操作,且已成功安装,则由于telnet服务是由xinetd守护的,所以我们需要重新启动xinetd

service xinetd restart

[test@localhost ~]$ service xinetd restart
Redirecting to /bin/systemctl restart xinetd.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: root
Password: 



polkit-agent-helper-1: pam_authenticate failed: Authentication failure
==== AUTHENTICATION FAILED ===
Failed to restart xinetd.service: Access denied
See system logs and 'systemctl status xinetd.service' for details.
[test@localhost ~]$ 
[test@localhost ~]$ 
[test@localhost ~]$ 
[test@localhost ~]$

#如果执行报以上错误,则检查是否没有安装xinetd

rmp -qa xinetd

#安装xinetd

yum install -y xinetd

[root@localhost /]# rpm -qa xinetd
xinetd-2.3.15-14.el7.x86_64
[root@localhost /]# 

#重启xinetd
/bin/systemctl restart xinetd.service

[root@localhost /]# /bin/systemctl restart xinetd.service
[root@localhost /]# 

#xinetd启动成功,可以查看xinetd的运行情况
netstat -tnlp

4.可以ping通,但是telnet命令连接失败

[root@localhost ~]# ping 192.168.1.147
PING 192.168.1.147 (192.168.1.147) 56(84) bytes of data.
64 bytes from 192.168.1.147: icmp_seq=1 ttl=128 time=0.702 ms
64 bytes from 192.168.1.147: icmp_seq=2 ttl=128 time=1.50 ms
64 bytes from 192.168.1.147: icmp_seq=3 ttl=128 time=1.76 ms
^X64 bytes from 192.168.1.147: icmp_seq=4 ttl=128 time=1.80 ms
^C
--- 192.168.1.147 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3034ms
rtt min/avg/max/mdev = 0.702/1.442/1.804/0.443 ms
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# telnet 192.168.1.147 6379
Trying 192.168.1.147...
telnet: connect to address 192.168.1.147: Connection refused

可能存在情况:

1)物理网络链路不通:从A地点到B地点没有路可以走

2)防火墙没有开通相关网络:从A地点到B地点由路,但是有路障

3)目标主机没有启动:就没有B地点

我需要连接的是win系统的服务,

可以ping通,说明应该是防火墙有拦截

为指定端口设置规则:

打开win系统的防火墙设置

选择高级选项

选择入站规则,选中新建规则

选择端口、选择特定本地端口、输入端口号、选择允许连接、下一步保存

放开防火墙后,发现还是连接不上

通过查询资料发现,原来redis是开启了受保护模式

将redis.conf中的protected-mode设置为yes(保护模式),外网按理说无法访问
但是protected-mode它启用的条件有两个,第一是没有使用bind,第二是没有设置访问密码(默认没有密码),因此我们注释bind外面就访问不到了,
所以我们使用密码或者设置bind都会让保护模式失效,这样外网就能访问到。

127.0.0.1:6379>
127.0.0.1:6379>
127.0.0.1:6379> config get "protected-mode"
1) "protected-mode"
2) "yes"
127.0.0.1:6379> config set "protected-mode" no
OK
127.0.0.1:6379> config get "protected-mode"
1) "protected-mode"
2) "no"
127.0.0.1:6379>

5.切换用户

#当安装某些工具时,没有权限,需要切换用户

You need to be root to perform this command.

#需要root超级管理员权限才能执行特定命令,执行以下命令切换用户

su

此时需要输入密码

You need to be root to perform this command.
[test@localhost /]$ su
Password: 
[root@localhost /]#


http://www.niftyadmin.cn/n/5464091.html

相关文章

ROS2 学习(一)ROS2 简介与基本使用

参考引用 动手学 ROS2 1. ROS2 介绍与安装 1.1 ROS2 的历史 ROS&#xff08;Robot Operating System&#xff0c;机器人操作系统&#xff09;&#xff0c;但 ROS 本身并不是一个操作系统&#xff0c;而是可以安装在现在已有的操作系统上&#xff08;Linux、Windows、Mac&…

正弦实时数据库的应用(1)-数字孪生

前面说过实时数据库比较合适应用在数字孪生系统上&#xff0c;本篇就来对比一下数字孪生系统各种数据存储的应用方案的优缺点&#xff0c;几种典型的数据存储方式如下所示&#xff1a; 方案一&#xff1a;RedisMySQL/MongoDB方案二&#xff1a;MongoDB方案三&#xff1a;时序数…

如何使用PMKIDCracker对包含PMKID值的WPA2密码执行安全测试

关于PMKIDCracker PMKIDCracker是一款针对无线网络WPA2密码的安全审计与破解测试工具&#xff0c;该工具可以在不需要客户端或去身份验证的情况下对包含了PMKID值的WPA2无线密码执行安全审计与破解测试。 PMKIDCracker基于纯Python 3开发&#xff0c;旨在帮助广大安全研究人员…

如何在 Debian VPS 上添加、删除和授予用户 sudo 权限

简介 当你启动一个新的服务器时&#xff0c;会创建一个名为 root 的默认账户。这个用户拥有完全的系统访问权限&#xff0c;应该仅用于管理任务。作为 root 用户&#xff0c;你基本上可以对系统做任何操作&#xff0c;这很强大&#xff0c;但也极其危险。Linux 没有“撤销”按…

爬个数据这么吃力?别慌,代理IP轻松解决跨境电商技术瓶颈

目录 一、跨境电商所面临的挑战1、获取全球市场数据时&#xff0c;所面临的数据准确性问题&#xff1a;2、从事跨境电商运营时&#xff0c;所面临的网络安全挑战&#xff1a; 二、通过代理IP解决跨境电商问题1、访问海外公开数据2、独立IP防关联3、市场调研4、网络优化5、网络安…

java(4)之运算符

1、算术运算符 运算符含义表达式加11-减1-1*乘1*2/除2/1%取余5%2 2、赋值运算符 即 表示将右边的值赋给左边的变量 即 int i &#xff1b; i 1&#xff1b; 运算符含义 表达式 x xyxy-x x-yx - y*x x*yx*y/x x/yx /y%x x%yx %y 代码示例 public class Main {pub…

后端返还二进制excl表格数据时候,如何实现在前端下载表格功能及出现表格打开失败的异常处理。

背景&#xff1a; 后端返还一个二进制流的excl表格数据&#xff0c;前端需要对其解析&#xff0c;然后可提供给客户进行下载。 思路&#xff1a;把二进制流数据转换给blob对象&#xff0c;然后利用a标签进行前端下载。 代码&#xff1a; 后端返还 类似如下的数据 前端代码…

K8S之Secret的介绍和使用

Secret Secret的介绍Secret的使用通过环境变量引入Secret通过volume挂载Secret Secret的介绍 Secret是一种保护敏感数据的资源对象。例如&#xff1a;密码、token、秘钥等&#xff0c;而不需要把这些敏感数据暴露到镜像或者Pod Spec中。Secret可以以Volume或者环境变量的方式使…