PowerShell - 使用 SSH 连接远程主机,提示主机指纹信息验证失败(Host key verification failed.)

本文讲述了如何在PowerShell中遇到SSH连接Ubuntu虚拟机的警告,原因可能是旧密钥冲突。通过删除.ssh/known_hosts中的过期指纹信息,解决了主机身份验证错误,确保了安全连接。

事情是这样的,刚刚在 PowerShell 中使用 SSH 连接一台运行在虚拟机中的 Ubuntu 主机,然后提示主机指纹信息验证失败,可能遭受中间人攻击:

PS C:\Users\86188> ssh -l mk 192.168.88.128
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 ECDSA key sent by the remote host is
SHA256:xGND4WU
[16:44:32.385] Log Level: 2 [16:44:32.398] VS Code version: 1.105.1 [16:44:32.398] Remote-SSH version: remote-ssh@0.120.0 [16:44:32.398] win32 x64 [16:44:32.399] SSH Resolver called for "ssh-remote+192.168.17.128", attempt 1 [16:44:32.400] remote.SSH.useLocalServer = false [16:44:32.400] remote.SSH.useExecServer = true [16:44:32.400] remote.SSH.bindHost = {} [16:44:32.400] remote.SSH.showLoginTerminal = false [16:44:32.400] remote.SSH.remotePlatform = {"192.168.17.128":"linux"} [16:44:32.400] remote.SSH.path = undefined [16:44:32.400] remote.SSH.configFile = undefined [16:44:32.401] remote.SSH.useFlock = true [16:44:32.401] remote.SSH.lockfilesInTmp = false [16:44:32.401] remote.SSH.localServerDownload = auto [16:44:32.401] remote.SSH.remoteServerListenOnSocket = false [16:44:32.401] remote.SSH.defaultExtensions = [] [16:44:32.401] remote.SSH.defaultExtensionsIfInstalledLocally = [] [16:44:32.401] remote.SSH.loglevel = 2 [16:44:32.401] remote.SSH.enableDynamicForwarding = true [16:44:32.401] remote.SSH.enableRemoteCommand = false [16:44:32.401] remote.SSH.serverPickPortsFromRange = {} [16:44:32.401] remote.SSH.serverInstallPath = {} [16:44:32.401] remote.SSH.permitPtyAllocation = false [16:44:32.401] remote.SSH.preferredLocalPortRange = undefined [16:44:32.402] remote.SSH.useCurlAndWgetConfigurationFiles = false [16:44:32.402] remote.SSH.experimental.chat = false [16:44:32.402] remote.SSH.experimental.enhancedSessionLogs = false [16:44:32.402] remote.SSH.httpProxy = {} [16:44:32.402] remote.SSH.httpsProxy = {} [16:44:32.410] SSH Resolver called for host: 192.168.17.128 [16:44:32.410] Setting up SSH remote "192.168.17.128" [16:44:32.417] Using commit id "7d842fb85a0275a4a8e4d7e040d2625abbf7f084" and quality "stable" for server [16:44:32.417] Extensions to install: [16:44:32.429] Install and start server if needed [16:44:32.430] Checking ssh with "D:\miniconda3\Scripts\ssh.exe -V" [16:44:32.432] Got error from ssh: spawn D:\miniconda3\Scripts\ssh.exe ENOENT [16:44:32.432] Checking ssh with "D:\Miniconda3\envs\python386\Library\bin\ssh.exe -V" [16:44:32.433] Got error from ssh: spawn D:\Miniconda3\envs\python386\Library\bin\ssh.exe ENOENT [16:44:32.433] Checking ssh with "D:\Program Files\python3.7.0\Scripts\ssh.exe -V" [16:44:32.433] Got error from ssh: spawn D:\Program Files\python3.7.0\Scripts\ssh.exe ENOENT [16:44:32.433] Checking ssh with "D:\Program Files\python3.7.0\ssh.exe -V" [16:44:32.434] Got error from ssh: spawn D:\Program Files\python3.7.0\ssh.exe ENOENT [16:44:32.434] Checking ssh with "D:\Program Files\python3.8.6\Scripts\ssh.exe -V" [16:44:32.435] Got error from ssh: spawn D:\Program Files\python3.8.6\Scripts\ssh.exe ENOENT [16:44:32.435] Checking ssh with "D:\Program Files\python3.8.6\ssh.exe -V" [16:44:32.435] Got error from ssh: spawn D:\Program Files\python3.8.6\ssh.exe ENOENT [16:44:32.435] Checking ssh with "E:\Program Files (x86)\VMware\VMware Workstation\bin\ssh.exe -V" [16:44:32.436] Got error from ssh: spawn E:\Program Files (x86)\VMware\VMware Workstation\bin\ssh.exe ENOENT [16:44:32.436] Checking ssh with "C:\windows\system32\ssh.exe -V" [16:44:32.437] Got error from ssh: spawn C:\windows\system32\ssh.exe ENOENT [16:44:32.437] Checking ssh with "C:\windows\ssh.exe -V" [16:44:32.437] Got error from ssh: spawn C:\windows\ssh.exe ENOENT [16:44:32.437] Checking ssh with "C:\windows\System32\Wbem\ssh.exe -V" [16:44:32.438] Got error from ssh: spawn C:\windows\System32\Wbem\ssh.exe ENOENT [16:44:32.438] Checking ssh with "C:\windows\System32\WindowsPowerShell\v1.0\ssh.exe -V" [16:44:32.439] Got error from ssh: spawn C:\windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT [16:44:32.439] Checking ssh with "C:\windows\System32\OpenSSH\ssh.exe -V" [16:44:32.478] > OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2 [16:44:32.481] Running script with connection command: "C:\windows\System32\OpenSSH\ssh.exe" -T -D 50809 "192.168.17.128" sh [16:44:32.483] Generated SSH command: 'type "C:\Users\admin\AppData\Local\Temp\vscode-linux-multi-line-command-192.168.17.128-99131704.sh" | "C:\windows\System32\OpenSSH\ssh.exe" -T -D 50809 "192.168.17.128" sh' [16:44:32.483] Using connect timeout of 17 seconds [16:44:32.484] Terminal shell path: C:\windows\System32\cmd.exe [16:44:32.681] > [16:44:32.681] Got some output, clearing connection timeout [16:44:32.774] > @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ [16:44:32.803] > @ 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 ED25519 key sent by the remote host is > SHA256:aZEoUKcUE8VVq8PAud1h5zzksIIDqrHaXA27FekXaXE. > Please contact your system administrator. > Add correct host key in C:\\Users\\admin/.ssh/known_hosts to get rid of this message. > Offending ECDSA key in C:\\Users\\admin/.ssh/known_hosts:3 > Host key for 192.168.17.128 has changed and you have requested strict checking. > Host key verification failed. > 过程试图写入的管道不存在。 [16:44:34.067] "install" terminal command done [16:44:34.067] Install terminal quit with output: 过程试图写入的管道不存在。 [16:44:34.068] Received install output: 过程试图写入的管道不存在。 [16:44:34.068] WARN: $PLATFORM is undefined in installation script output. Errors may be dropped. [16:44:34.068] Failed to parse remote port from server output [16:44:34.069] Resolver error: Error at y.Create (c:\Users\admin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:744751) at t.handleInstallOutput (c:\Users\admin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:742832) at t.tryInstall (c:\Users\admin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:865534) at async c:\Users\admin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:824246 at async t.withShowDetailsEvent (c:\Users\admin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:827501) at async A (c:\Users\admin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:820760) at async t.resolve (c:\Users\admin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:824898) at async c:\Users\admin\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:1113660 [16:44:34.072] ------ [16:44:34.072] No hints found in the recent session.
最新发布
10-29
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值