OSX ssh: Connection closed by [IP]
10,006
Solution 1
It looks like that the ssh server did not accept the kind of authentication the ssh-client wants to use. Or that root is generally not allowed for ssh access. The better way to find a solution is to access the ssh.log on the ssh-server. There you will find detailed information why the connection establishment is rejected.
ciao ryder
Solution 2
I had a similar problem a while ago, this helped me: https://discussions.apple.com/thread/3008731
tl;dr: The permissions of the file /etc/ssh_host_dsa_key should be 700 otherwise the ssh connection will fail.
To fix:
sudo chmod 700 /etc/ssh_host_dsa_key
Related videos on Youtube
Author by
Drew
Updated on September 18, 2022Comments
-
Drew over 1 year
So when I try to ssh from one of my mac to another mac like this:
ssh [email protected]
I get:
Connection closed by 192.168.1.64
I tried:
ssh -vvv [email protected]
and get:
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
Any ideas???
-
MysticForce almost 8 yearsDid you find a solution for this? I am facing the same issue with 'ssh localhost'
-
Roy Ryando about 3 yearsI know it was 11 years old thread but have you found the solution? I can't connect to all server
-
-
Drew about 9 yearswhere can I find this ssh.log on the ssh server?
-
Drew about 9 yearsthank you for reply but it didn't help.. In fact I have even the 600 rights for this key (it shouldn't be executable so 600 is totally enough) and it still doesn't work...
-
ryder about 9 yearsthis depends on the Mac OS X version you use. I can find the infos on Version 10.10.X in /var/log/system.log. Did you also remeber to allow the ssh login via System Preferences? See here for details how to do this: osxdaily.com/2011/09/30/remote-login-ssh-server-mac-os-x
-
naudster almost 5 yearsThanks. Exactly my problem. My keys were 600 and although the mac ssh client would prompt for the password, I was getting "Connection closed" once it was entered. Chmod'ing to 700 fixed it.
-
SPRBRN over 4 yearsdidn't work for me on Mojave 10.14