【发布时间】:2019-04-15 00:20:09
【问题描述】:
在将 Ubuntu 更新到 16.04 后,我的 ssh 连接出现了一些问题,现在连接需要密码,尽管我的公钥是通过 ssh-copy-id 复制到远程授权密钥中的。在收到新的 ssh-copy-id 后,我收到 key_load_public: invalid format,为了确保正确的密钥格式,我通过 ssh-keygen 生成了新密钥并重新启动 ssh-copy-id 但结果相同 key_load_public: invalid format,与我必须输入密码的所有 ssh 连接相同。
如何在我的远程服务器上生成密钥并复制而不会收到此“无效格式”错误?
ssh -v <user>@<host-name>:
OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: /etc/ssh/ssh_config line 57: Deprecated option "useroaming"
debug1: Connecting to <host-name> [<ip>] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/<user>/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/<user>/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/<user>/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/<user>/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/<user>/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/<user>/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/<user>/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/<user>/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to <my_host>:22 as '<user>'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:2XmTTbzpU31c8OfZCyzMPspS9HE0VASPA7RliKRX5aA
The authenticity of host '<host-name> (<ip>)' can't be established.
ECDSA key fingerprint is SHA256:2XmTTbzpU31c8OfZCyzMPspS9HE0VASPA7RliKRX5aA.
【问题讨论】:
-
您使用的是什么密钥类型?完整的调试日志是什么样的?
-
Stackoverflow 为软件开发提供帮助。对于一般 ssh 使用的问题,您应该考虑在 Super User 或 Unix & Linux 上提问。话虽如此,我在您的问题中包含的 ssh 调试输出中没有看到无效的格式错误。如果您认为这个问题是这里的主题,您应该 edit 您的问题包含一个 ssh 调用,该调用实际上证明了您遇到的问题。
-
好吧,你是对的!如何将我的问题转移到超级用户或 Unix 和 Linux?