Ssh

如何在 Windows 主機上使用帶有 plink.exe 的 Linux 伺服器上的 ssh 主機密鑰?

  • December 20, 2018

我有 Linux 伺服器正在執行sshd

如何提供hostkey從Linux伺服器到plink.exeWindows?

例如:跑步plink.exe -ssh -batch -m plink.tmp -hostkey ...

您可以使用 plink 本身來獲取主機密鑰:

c:\> plink -v -batch host
Connecting to 1.2.3.4 port 22
We claim version: SSH-2.0-PuTTY_Release_0.68
Server version: SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.1
Using SSH protocol version 2
Doing ECDH key exchange with curve Curve25519 and hash SHA-256
Server also has ssh-ed25519/ecdsa-sha2-nistp256 host keys, but we don't know any of them
Host key fingerprint is:
ssh-rsa 2048 c6:e7:49:ec:07:5b:30:02:d9:57:dd:7f:39:e3:f3:35
Initialised AES-256 SDCTR client->server encryption
Initialised HMAC-SHA-256 client->server MAC algorithm
Initialised AES-256 SDCTR server->client encryption
Initialised HMAC-SHA-256 server->client MAC algorithm
Disconnected: Unable to authenticate

-v附加資訊需要參數(verbose),-batch確保 plink 無需登錄直接退出(只要未提供使用者名和密碼)。

在輸出中找到Host key fingerprint is:,後跟十六進制格式的指紋,在這種情況下:

c6:e7:49:ec:07:5b:30:02:d9:57:dd:7f:39:e3:f3:35

這是您必須提供的字元串,plink -hostkey以確認目標主機實際上是它聲稱的主機。

引用自:https://serverfault.com/questions/939648