sFtp 带密钥验证提示输入密码

sFtp 带密钥验证提示输入密码

我是 sFtp 和通过密钥文件进行身份验证的新手。这是我的问题;

1-我有一个.p12证书(由主机所有者提供);我使用openssl从中提取我的私钥(.pem)文件。

2-使用此文件;我尝试通过 WinSCP 客户端登录;由于 WinSCP 不支持 .pem 文件;我将该文件转换为 .ppk 格式。

3-当我尝试使用 .ppk 文件登录时;似乎主机没有拒绝我的密钥文件;但仍然提示输入密码(我没有密码,因为身份验证仅通过密钥文件进行)。所以我不知道我哪里做错了,为什么服务器仍然提示我输入密码;所以我只能看到“需要进一步身份验证”的消息。

以下是我尝试登录时的 WinSCP 客户端日志:

. Looking up host "xxxxx.yyyy" for SSH connection
. Connecting to xx.xxx.xxx.xxx port 22
. We claim version: SSH-2.0-WinSCP_release_5.11
. Server version: SSH-2.0-SSHD
. Using SSH protocol version 2
. Have a known host key of type rsa2
. Doing Diffie-Hellman group exchange
. Doing Diffie-Hellman key exchange with hash SHA-256
. Host key fingerprint is:
. ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
. Verifying host key rsa2 0x....
. Host key matches cached key
. Initialised AES-256 SDCTR client->server encryption
. Initialised HMAC-SHA1 client->server MAC algorithm
. Initialised AES-256 SDCTR server->client encryption
. Initialised HMAC-SHA1 server->client MAC algorithm
. Reading key file "C:\OpenSSL-Win64\bin\private.ppk"
! Using username "myusername".
. Server offered these authentication methods: password,publickey,keyboard-interactive
. Offered public key
. Offer of public key accepted
! Authenticating with public key "imported-openssh-key"
. Sent public key signature
! Further authentication required

答案1

标准 SSH/SFTP 协议不使用证书。只有一对简单的密钥。

OpenSSH 中有一个专有实现,允许使用证书:
https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?annotate=HEAD

但这仅由 OpenSSH 工具集(客户端和服务器)实现。

WinSCP、FileZilla 或 PuTTY(及其他)不支持这种专有身份验证方法。

但您的服务器似乎不是 OpenSSH。因此,您拥有证书的信息实际上可能是错误的。

相关内容