ssh 无法解密 rsa 私钥

ssh 无法解密 rsa 私钥

我注意到将代码推送到朋友的 gitlab 时遇到的问题。如果指定供 ssh 使用的 rsa 密钥使用密码加密,则 ssh 无法要求我提供密码,并且随后无法使用私钥进行身份验证。

我尝试过使用密码和选项默认生成 rsa 密钥

ssh-keygen -t rsa -b 4096 -o -a 100

同样,没有任何改变。

我尝试在自己的系统上托管 sshd,为自己的用户设置密钥(将 .pub 复制到authorized_keys),奇怪的是,结果相同。密钥的权限似乎不是问题。

我正在运行带有未修改的 Linux 内核的 ArchLinux 64 位。

这是我自己的系统上的示例日志,ssh -i test -p 9988 -vt 127.0.0.1其中 sshd 以大部分默认设置运行(禁用密码,仅允许公钥身份验证,端口设置为 9988)。密钥是使用默认设置生成的,并在其上设置了加密密码。

OpenSSH_6.8p1, OpenSSL 1.0.2c 12 Jun 2015
debug1: Reading configuration data /home/stephen/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 9988.
debug1: Connection established.
debug1: identity file test type 1
debug1: key_load_public: No such file or directory
debug1: identity file test-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.8
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.8
debug1: match: OpenSSH_6.8 pat OpenSSH* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr [email protected] none
debug1: kex: client->server aes128-ctr [email protected] none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:jNykvy5o5p79HUka+BWOqLoMqB0oo90fupUT18ERxMA
debug1: Host '[127.0.0.1]:9988' is known and matches the ECDSA host key.
debug1: Found key in /home/stephen/.ssh/known_hosts:2
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: test
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Offering RSA public key: stephen@ArchDynamo
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

编辑:我最近推送到我朋友的 gitlab 并意识到它这样做时没有提示我输入密钥密码。这是否意味着我的 ssh-keygen 已损坏?

相关内容