尝试连接到一台机器上的 SSH 服务器,效果很好。不在另一个

尝试连接到一台机器上的 SSH 服务器,效果很好。不在另一个
~$ ssh -v [email protected]
OpenSSH_6.9p1, LibreSSL 2.1.7
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: /etc/ssh/ssh_config line 25: Applying options for *
debug1: Connecting to 45.79.8.241 [45.79.8.241] port 22.
debug1: Connection established.
debug1: identity file /Users/raina/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/raina/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/raina/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/raina/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/raina/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/raina/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/raina/.ssh/id_ed25519 type -1
debug1: identity file /Users/raina/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/raina/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.1p1-hpn14v9
debug1: match: OpenSSH_7.1p1-hpn14v9 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 45.79.8.241:22 as 'raina'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client [email protected] <implicit> none
debug1: kex: client->server [email protected] <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-ed25519 SHA256:LQ1K6AddhnCMm3KVYX46yS9RZFcM8szWf+tpuCgtb/E
debug1: Host '45.79.8.241' is known and matches the ED25519 host key.
debug1: Found key in /Users/raina/.ssh/known_hosts:1
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:
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug1: Authentication succeeded (publickey).
Authenticated to 45.79.8.241 ([45.79.8.241]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8

其他机器:

$ ssh -v [email protected]
OpenSSH_7.1p1, OpenSSL 1.0.2d 9 Jul 2015
debug1: Connecting to 45.79.8.241 [45.79.8.241] port 22.
debug1: Connection established.
debug1: identity file /home/Administrator/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Administrator/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Administrator/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Administrator/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Administrator/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Administrator/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Administrator/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Administrator/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.1p1-hpn14v9
debug1: match: OpenSSH_7.1p1-hpn14v9 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 45.79.8.241:22 as 'raina'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client [email protected] <implicit> none
debug1: kex: client->server [email protected] <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-ed25519 SHA256:LQ1K6AddhnCMm3KVYX46yS9RZFcM8szWf+tpuCgtb/E
debug1: Host '45.79.8.241' is known and matches the ED25519 host key.
debug1: Found key in /home/Administrator/.ssh/known_hosts:1
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: /home/Administrator/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/Administrator/.ssh/id_dsa
debug1: Trying private key: /home/Administrator/.ssh/id_ecdsa
debug1: Trying private key: /home/Administrator/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

是什么赋予了?两者的 id_rsa 相同

答案1

我想通了这个问题。 OSX 使用它自己的钥匙串,而不是像普通 BSD 或 Linux 系统那样使用 .ssh 中的钥匙串。

我只需要将 id_rsa 文件添加到钥匙串中,然后重新复制。

此后私钥工作正常。

从这里得到的信息: http://fplanque.com/dev/mac/secure-ssh-private-keys-on-mac-osx-10-5

相关内容