因此,当我尝试从我的一台 Mac ssh 到另一台 Mac 时,如下所示:
ssh [email protected]
我得到:
Connection closed by 192.168.1.64
我试过:
ssh -vvv [email protected]
并得到:
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to macbookpro.local [192.168.1.64] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/Users/Andryuwka/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /Users/Andryuwka/.ssh/id_rsa type 1
debug1: identity file /Users/Andryuwka/.ssh/id_rsa-cert type -1
debug1: identity file /Users/Andryuwka/.ssh/id_dsa type -1
debug1: identity file /Users/Andryuwka/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2
debug1: match: OpenSSH_6.2 pat OpenSSH*
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 192.168.1.64
有任何想法吗???
答案1
看起来 ssh 服务器不接受 ssh 客户端想要使用的身份验证类型。或者 root 通常不允许进行 ssh 访问。找到解决方案的更好方法是访问 ssh 服务器上的 ssh.log。在那里,您将找到拒绝建立连接的详细信息。
你好,赖德
答案2
我之前遇到过类似的问题,这对我有帮助: https://discussions.apple.com/thread/3008731
tl;dr:文件 /etc/ssh_host_dsa_key 的权限应该是 700,否则 ssh 连接将失败。
修理:
sudo chmod 700 /etc/ssh_host_dsa_key