Macos Can';t通过本地主机或远程计算机将ssh连接到我的mac

Macos Can';t通过本地主机或远程计算机将ssh连接到我的mac,macos,ssh,openssh,Macos,Ssh,Openssh,我已经研究了好几天了,但是我能找到答案。 我既不能从本地主机也不能从另一台机器ssh到我的mac。 下面是sshuser@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

我已经研究了好几天了,但是我能找到答案。 我既不能从本地主机也不能从另一台机器ssh到我的mac。 下面是
sshuser@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  

从表面上看,这个问题完全是基于密钥被损坏或其他原因

日志首先说,您的公钥不是RSA密钥,尽管它被命名为RSA密钥,但它尝试开始读取它,不管它是否能够自己工作,然后它无法读取它。听起来像是损坏的密钥文件

我的建议是删除ssh密钥等,然后重新启动,或者作为一种临时措施,更改配置以允许密码身份验证,而不是基于密钥

如果要删除按键,请打开终端并执行以下操作:

rm -R /Users/MYUSERNAME/.ssh/id_*
要为安全无密码登录生成新密码,请执行以下操作:

ssh-keygen -b 1024 -t rsa -f id_rsa -P ""

您是否已在共享设置中启用远程登录?是,我已启用远程登录。这就是为什么我如此困惑。