密钥变更检查导致VScode远程SSH时无法连接服务器

报错

使用vscode的Remote - SSH插件远程连接不同服务器时报错如下

[11:42:51.784] Log Level: 2
[11:42:51.792] SSH Resolver called for "ssh-remote+27.23.24.103", attempt 1
[11:42:51.793] "remote.SSH.useLocalServer": false
[11:42:51.793] "remote.SSH.useExecServer": true
[11:42:51.793] "remote.SSH.showLoginTerminal": false
[11:42:51.794] "remote.SSH.remotePlatform": {"ubt01":"linux"}
[11:42:51.794] "remote.SSH.path": undefined
[11:42:51.794] "remote.SSH.configFile": undefined
[11:42:51.794] "remote.SSH.useFlock": true
[11:42:51.794] "remote.SSH.lockfilesInTmp": false
[11:42:51.796] "remote.SSH.localServerDownload": auto
[11:42:51.797] "remote.SSH.remoteServerListenOnSocket": false
[11:42:51.797] "remote.SSH.showLoginTerminal": false
[11:42:51.797] "remote.SSH.defaultExtensions": []
[11:42:51.797] "remote.SSH.loglevel": 2
[11:42:51.797] "remote.SSH.enableDynamicForwarding": true
[11:42:51.797] "remote.SSH.enableRemoteCommand": false
[11:42:51.797] "remote.SSH.serverPickPortsFromRange": {}
[11:42:51.797] "remote.SSH.serverInstallPath": {}
[11:42:51.801] VS Code version: 1.88.1
[11:42:51.801] Remote-SSH version: remote-ssh@0.110.1
[11:42:51.801] win32 x64
[11:42:51.805] SSH Resolver called for host: 27.23.24.103
[11:42:51.805] Setting up SSH remote "27.23.24.103"
[11:42:51.809] Using commit id "e170252f762678dec6ca2cc69aba1570769a5d39" and quality "stable" for server
[11:42:51.814] Install and start server if needed
[11:42:53.512] Checking ssh with "C:\Windows\system32\ssh.exe -V"
[11:42:53.515] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT
[11:42:53.515] Checking ssh with "C:\Windows\ssh.exe -V"
[11:42:53.516] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT
[11:42:53.516] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V"
[11:42:53.518] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT
[11:42:53.518] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[11:42:53.519] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[11:42:53.519] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[11:42:53.575] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5[11:42:53.582] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 60388 "27.23.24.103" bash
[11:42:53.585] Terminal shell path: C:\Windows\System32\cmd.exe
[11:42:54.954] > @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> ]0;C:\Windows\System32\cmd.exe
[11:42:54.955] Got some output, clearing connection timeout
[11:42:54.970] > @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
> Someone could be eavesdropping on you right now (man-in-the-middle attack)!     
> It is also possible that a host key has just been changed.
> The fingerprint for the RSA key sent by the remote host is
> SHA256:g9XWs/eWk6STHGxpFzaEQQCPAeXtPn5+NhcXDu3vfwc.
> Please contact your system administrator.
> Add correct host key in C:\\Users\\Administrator/.ssh/known_hosts to get rid of 
> this message.
> Offending RSA key in C:\\Users\\Administrator/.ssh/known_hosts:7
> RSA host key for 27.23.24.103 has changed and you have requested strict checking
> .
> Host key verification failed.
> 过程试图写入的管道不存在。
> 
[11:42:56.262] "install" terminal command done
[11:42:56.263] Install terminal quit with output: 过程试图写入的管道不存在。
[11:42:56.263] Received install output: 过程试图写入的管道不存在。
[11:42:56.264] Failed to parse remote port from server output
[11:42:56.265] Resolver error: Error: at g.Create (c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.110.1\out\extension.js:2:499181)at t.handleInstallOutput (c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.110.1\out\extension.js:2:496503)at t.tryInstall (c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.110.1\out\extension.js:2:620043)at async c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.110.1\out\extension.js:2:579901at async t.withShowDetailsEvent (c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.110.1\out\extension.js:2:583207)at async k (c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.110.1\out\extension.js:2:576866)at async t.resolve (c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.110.1\out\extension.js:2:580578)at async c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.110.1\out\extension.js:2:846687
[11:42:56.273] ------[11:42:56.657] Opening exec server for ssh-remote+27.23.24.103
[11:42:56.671] Initizing new exec server for ssh-remote+27.23.24.103
[11:42:56.704] Using commit id "e170253463534545RYF3456RG69aba1570769a5d39" and quality "stable" for server
[11:42:56.706] Install and start server if needed
[11:43:06.409] getPlatformForHost was canceled
[11:43:06.410] Exec server for ssh-remote+27.23.24.103 failed: Error: Connecting was canceled
[11:43:06.411] Error opening exec server for ssh-remote+27.23.24.103: Error: Connecting was canceled

原因

 SSH主机密钥验证失败而未能成功建立连接。预期服务器的SSH密钥会发生变化,或者你更换了服务器,就需要更新本地的`known_hosts`文件。

解决

以下是日志中的一些关键信息和可能的解决方案:

### 关键信息:

1. **SSH Resolver调用**:Remote - SSH扩展尝试连接到IP地址`27.23.24.103`。

2. **SSH客户端路径**:VSCode找到了`C:\Windows\System32\OpenSSH\ssh.exe`作为SSH客户端。

3. **SSH连接命令**:使用了以下命令尝试建立SSH连接:
   ```
   "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 60388 "27.23.24.103" bash
   ```

4. **主机密钥变更警告**:VSCode提示远程主机的RSA密钥发生了变化,这通常意味着本地的`known_hosts`文件中的密钥与远程主机当前的密钥不匹配。

5. **连接失败**:由于主机密钥验证失败,SSH连接尝试失败。

6. **取消连接**:在尝试安装和启动服务器时,连接被取消。

### 可能的解决方案:

1. **检查SSH密钥**:如果你预期服务器的SSH密钥会发生变化,或者你更换了服务器,你需要更新本地的`known_hosts`文件。

2. **更新`known_hosts`**:你可以通过以下方式更新或删除本地的密钥记录:
   - 手动打开`C:\Users\Administrator\.ssh\known_hosts`文件,找到对应的主机条目并删除。
   - 或者,使用SSH命令连接时,使用`-o StrictHostKeyChecking=no`参数来跳过密钥检查(这会降低安全性,因为它容易受到中间人攻击)。

3. **确保SSH客户端正确安装**:确保`ssh.exe`位于指定路径,并且可以正常工作。

4. **检查网络连接**:确保你的网络连接可以到达远程服务器的IP地址,并且没有防火墙或路由器设置阻止了SSH连接。

5. **检查服务器状态**:确认远程服务器已经启动并且SSH服务正在运行。

6. **检查SSH配置**:确认VSCode的SSH配置没有错误,包括用户名、端口以及任何需要的密钥或密码。

7. **查看详细日志**:如果问题仍然存在,你可以通过增加Remote - SSH扩展的日志级别来获取更详细的信息,以便进一步调试。

8. **联系系统管理员**:如果你不确定如何处理SSH密钥更改的问题,联系服务器的系统管理员获取帮助。

注意

跳过主机密钥检查会降低安全性,因此只在你信任网络环境和远程主机时才使用。在生产环境中,始终确保使用最新的密钥,并且不要跳过密钥检查。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/835903.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

使用vue3以及原生input实现一个可复用的组件(包括各种数组类型,手机号类型,小数类型)

看标题要实现可复用 那我就注册到全局组件里面 在component.ts //注册全局公共组件 import MxInput from /components/common/MxInput.vue const commonComponents {install(Vue) {Vue.component(MxInput, MxInput)} }; export default commonComponents;子组件:…

【实战】采用jenkins pipeline实现自动构建并部署至k8s

文章目录 前言部署jenkins编写docker-compose-jenkins.yaml配置maven源启动jenkins解锁jenkins Jenkins默认插件及git、镜像仓库、k8s凭证配置host key verification configuration修改为不验证Gitee ssh阿里云镜像仓库ssh编写pipeline安装以下常用插件将kubectl命令文件拷贝到…

E - Yet Another Sigma Problem(ABC字典树)

思路:我们可以发现两个字符串的最长公共前缀就是字典树中的最近公共祖先。然而这道题,比如说某个结点是x个字符串的前缀,那么当前结点对答案的贡献为x * (x - 1) / 2,就是x中任选两个字符串组合,因为在这之前&#xff…

【Win10设备管理器中无端口选项】

计算机疑难杂症分享002 Win10设备管理器中无端口选项1、问题现象2、问题原因3、问题解决3.1、驱动精灵(亲测的此方法)3.2、添加过时硬件3.3、官方的方法 Win10设备管理器中无端口选项 1、问题现象 当我调试串口通信时,发现打开设备管理器没有端口,打开…

Docker停止不了

报错信息 意思是,docker.socket可能也会把docker服务启动起来 解决 检查服务状态 systemctl status dockersystemctl is-enabled docker停止docker.socket systemctl stop docker.socket停止docker systemctl stop docker知识扩展 安装了docker后,…

[ue5]编译报错:使用未定义的 struct“FPointDamageEvent“

编译报错,错误很多,但很明显核心问题是第一个:使用未定义的 struct“FPointDamageEvent“: 程序没有找到FPointDamageEvent的定义。 解决办法: 处理这类未定义都可以先F12,找到它的库位置,之后…

部署yolov5

1 创建一个yolov5的环境 conda create -n yolov5 python3.8 2 激活环境 conda activate yolov5 3 设置清华源 pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple 4 PyTorch 网站下载pytorch 备注:也可以使用pip install 5 下载 yolov5…

iOS collectionViewCell显示选中颜色

demo git地址:点这里 原理思想简介 reloadData只会刷新内存中保存的cell,注意cell会复用,所以最多会刷新当前显示的加上一个用来复用的cell。实现的思想有两种: 设置一个全局的变量保存选中的位置,然后刷新collectio…

数据可视化训练第四天(模拟投掷筛子并且统计频次)

投掷一个筛子 import matplotlib.pyplot as plt from random import randint import numpy as npclass Die:"""模拟投掷筛子"""def __init__(self,num_sides6):self.num_sidesnum_sidesdef roll(self):return randint(1,self.num_sides)num1000…

知识付费系统的骗局,网上补课平台怎么收费?标准是什么?

随着教育的不断改革和更新,一种全新的授课方式出现在大众眼前,利用网课服务平台进行在线授课教学,不管是小学生、中学生还是大学生都可以进行网上学习。那么网上补课平台怎么收费?标准是什么? 网上补课平台收费标准一般来说在线一对一家教可…

【初中数学竞赛】x^x=(4/9)^(4/9),x≠4/9,求x?

题 初中数学 初中数学竞赛模拟练习 已知 x x ( 4 9 ) 4 9 x^x(\frac{4}{9})^\frac{4}{9} xx(94​)94​, x ≠ 4 9 x\neq\frac{4}{9} x94​,求值 x _ _ _ _ _ x\_\_\_\_\_ x_____。 解 x x ( ( 2 3 ) 2 ) ( 4 9 ) ( 2 3 ) 2 4 9 ( 2 3 ) 8 9 ( 2…

泰迪智能科技大数据开发实训平台功能介绍

大数据开发实训平台是面向实训课和课后训练的编程实训平台,平台底层基于Docker技术,采用容器云部署方案,预装大数据相关课程教学所需的实训环境,拥有1主2从的Hadoop集群,还能够自主定制环境,并能够与实训管…

C++接口:构建模块化与可扩展的软件架构

目录标题 1. 接口的定义与作用2. 抽象类作为接口3. 接口的设计原则4. 示例:使用接口实现多态5. 拓展:接口和类的区别6. 结论 在C编程中,接口是一种重要的设计模式,它定义了一组方法,这些方法可以被不同的类实现。接口在…

高架学习笔记之主要敏捷方法概览

一、极限编程(Extreme Programming,XP) XP是一个轻量级、灵巧、严谨周密的开发方法,它的价值观是交流,朴素,反馈和勇气,可理解为加强交流,从简单做起,寻求反馈&#xff0…

深入理解 JavaScript 中的 Promise、async 和 await

序言 在 JavaScript 中,异步编程是一项关键技能。为了更有效地处理异步任务,JavaScript 在其生命周期中引入了一系列功能。其中,Promise、async 和 await 是现代 JavaScript 中最重要的异步编程工具之一。本文将深入探讨这些概念&#xff0c…

WebAssembly在现代前端中的应用与未来展望

WebAssembly(简称WASM)在现代前端开发中的应用日益广泛,其核心优势在于提供了一种高性能、跨平台的执行环境,使得非JavaScript语言编写的代码也能在Web浏览器中运行。以下是WebAssembly在现代前端应用的一些关键领域及其未来展望&…

Java | Leetcode Java题解之第83题删除排序链表中的重复元素

题目: 题解: class Solution {public ListNode deleteDuplicates(ListNode head) {if (head null) {return head;}ListNode cur head;while (cur.next ! null) {if (cur.val cur.next.val) {cur.next cur.next.next;} else {cur cur.next;}}return…

C++调用有依赖库的python函数(VS2017+WIN10+Anaconda虚拟环境)

情况1.在写的函数中依赖了能够pip的库,例如numpy库、torch库,见下面的函数: import numpy as np import torch def add1(a, b):# 确保a和b都是NumPy数组a_array np.array(a) if not isinstance(a, np.ndarray) else ab_array np.array(b) if not isins…

萤火虫优化算法(Firefly Algorithm)

注意:本文引用自专业人工智能社区Venus AI 更多AI知识请参考原站 ([www.aideeplearning.cn]) 算法背景 萤火虫优化算法,是由剑桥大学的Xin-She Yang在2009年提出的一种基于群体智能的优化算法。它的灵感来源于萤火虫在夜晚闪烁…

Blender细节补充

1.饼状菜单,用于快速切换/选择 例如: ~:切换视图 Z:切换着色方式 ,:切换坐标系 .:切换基准点 Shift S:吸附 有两种使用方式: -点选 -滑选,按快捷键…