首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ssh key_load_public:无效格式警告

ssh key_load_public:无效格式警告
EN

Unix & Linux用户
提问于 2016-04-27 14:37:09
回答 8查看 72.8K关注 0票数 11

SSHing进入我的系统是成功的,但是即使没有-v标志,我也会得到key_load_public: invalid format消息。下面是使用详细标志的输出w。

具体来说

debug1: key_load_public: No such file or directory debug1: identity file /home/myname/.ssh/private_rsa_key-cert type -1

似乎是个问题,因为我没有这样的文件。但是,我检查了w/另一个系统,并得到了同样的两行。然而,在此之前并没有key_load_public: invalid format,这正是我真正想要摆脱的。两个远程系统上对authorized_keys文件的权限看起来是相同的,private_keys上的权限也是一样的。

代码语言:javascript
运行
复制
    $ ssh -v desired_host
    OpenSSH_7.2p2, OpenSSL 1.0.2g  1 Mar 2016
    debug1: Reading configuration data /home/myname/.ssh/config
    debug1: /home/dli/.ssh/config line 16: Applying options for desired_host
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to desired_host [X.X.X.X] port 22.
    debug1: Connection established.
    key_load_public: invalid format
    debug1: identity file /home/myname/.ssh/private_rsa_key type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/myname/.ssh/private_rsa_key-cert type -1
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_7.2
    debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
    debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
    debug1: Authenticating to desired_host:22 as 'myname'
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
    debug1: kex: host key algorithm: ssh-rsa
    debug1: kex: server->client cipher: aes128-ctr MAC: umac-64@openssh.com compression: none
    debug1: kex: client->server cipher: aes128-ctr MAC: umac-64@openssh.com compression: none
    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192) sent
    debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
    debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
    debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
    debug1: Server host key: ssh-rsa SHA256:EmG/FBK0OCXtaAqAkfHKxoXKLGiZiHUsQpObK6aWd30
    debug1: Host 'desired_host' is known and matches the RSA host key.
    debug1: Found key in /home/myname/.ssh/known_hosts:39
    debug1: rekey after 4294967296 blocks
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: rekey after 4294967296 blocks
    debug1: SSH2_MSG_NEWKEYS received
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
    debug1: Next authentication method: publickey
    debug1: Trying private key: /home/myname/.ssh/private_rsa_key
    debug1: Authentication succeeded (publickey).
    Authenticated to desired_host ([X.X.X.X]:22).
    debug1: channel 0: new [client-session]
    debug1: Requesting no-more-sessions@openssh.com
    debug1: Entering interactive session.
    debug1: pledge: network
EN

回答 8

Unix & Linux用户

发布于 2020-06-03 14:36:30

对我来说,同样的问题,不同的来源和解决方案:

我在客户端的id_rsa.foo文件夹中有id_rsa.foo.pub (正确的私钥)和id_rsa.foo.pub(匹配的公键)。删除或重命名公共密钥会使消息消失。

票数 5
EN

Unix & Linux用户

发布于 2016-04-27 15:45:14

有两条单独的信息:

这一条告诉您,.ssh/private_rsa_key格式错误:

代码语言:javascript
运行
复制
key_load_public: invalid format
debug1: identity file /home/myname/.ssh/private_rsa_key type -1

在没有-v开关的情况下,它不会出现,只是提供了一些信息,告诉您您没有证书:

代码语言:javascript
运行
复制
debug1: key_load_public: No such file or directory
debug1: identity file /home/myname/.ssh/private_rsa_key-cert type -1

第二条信息没有什么好担心的。

票数 3
EN

Unix & Linux用户

发布于 2018-10-14 20:42:24

当我发布

代码语言:javascript
运行
复制
ssh myid@mydomain

并收到消息(即使我成功地登录到远程框)

代码语言:javascript
运行
复制
key_load_public: invalid format

之所以发生这种情况,是因为我的本地~/..ssh/xxx.PUB实际上有我的私钥文件的内容,即使远程主机正确地将我的公钥放在了文件~myid/..ssh/authorized_ key中,所以解决方案是更正我的本地~/..ssh/xxx.bar,所以它拥有了我的公钥。

票数 3
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/279509

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档