我已经研究了好几天,但可以找到答案。
我无法从localhost或其他机器ssh到我的mac。
这是ssh user@localhost -vvv
输出:
OpenSSH_5.6p1, OpenSSL 0.9.8y 5 Feb 2013
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.1.2 [192.168.1.2] port 22.
debug1: Connection established.
debug3: Not a RSA1 key file /Users/MYUSERNAME/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /Users/MYUSERNAME/.ssh/id_rsa type 1
debug1: identity file /Users/MYUSERNAME/.ssh/id_rsa-cert type -1
debug1: identity file /Users/MYUSERNAME/.ssh/id_dsa type -1
debug1: identity file /Users/MYUSERNAME/.ssh/id_dsa-cert type -1
ssh_exchange_identification: Connection closed by remote host
答案 0 :(得分:2)
从外观来看,问题完全基于钥匙腐败或其他原因。
日志首先说明你的公钥不是RSA密钥,尽管它是这样命名的,它试图开始阅读它,不管它是否可以单独使用它然后它无法读取它。对我来说听起来像是损坏的密钥文件。
我的建议是删除你的ssh密钥等并重新开始,或者作为临时措施改变你的配置以允许密码验证而不是基于密钥。
如果要删除密钥,请打开终端并:
rm -R /Users/MYUSERNAME/.ssh/id_*
为安全无密码登录生成新的:
ssh-keygen -b 1024 -t rsa -f id_rsa -P ""