大网数据广告活动
服务器运维问答

How to use ssh hostkey from a Linux server with plink.exe on a Windows host?

· 52CE 我爱测

I have Linux server running sshd . How to provide hostkey from the Linux server to plink.exe on Windows? e.g.: for running plink.exe -ssh -batch -m plink.tmp -hostkey ...

问题原文

原帖链接 · cnd · CC BY-SA 4.0

I have Linux server running sshd.

How to provide hostkey from the Linux server to plink.exe on Windows?

e.g.: for running plink.exe -ssh -batch -m plink.tmp -hostkey ...

已采纳解答

原帖链接 · Gerald Schneider · CC BY-SA 4.0

You can use plink itself to get the host key:

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

The parameter -v (verbose) is needed for the additional information, -batch makes sure plink exits directly without a login (as long as username and password are not provided as well).

In the output you find Host key fingerprint is:, followed by the fingerprint in a hexadecimal format, in this case:

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

This is the string you have to provide to plink -hostkey to confirm that the target host is actually the host it claims to be.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-11-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。