Page 1 of 1

SSH server closes connections

Posted: Wed Dec 14, 2016 1:13 pm
by Hirza_Tango
Whenever I attempt co connect to my Pi3's ssh server, I get "Connection closed by <ip> port 22".

This is on a fresh Raspbian Jessie 11-25 install.

Attached is the output from

Code: Select all

ssh -vvv pi@192.168.1.33
http://pastebin.com/Q5GfNAbZ

I tried

Code: Select all

ssh -vvv pi@localhost
on the pi with similar results.



Thanks in advance!

Re: SSH server closes connections

Posted: Wed Dec 14, 2016 1:33 pm
by klricks
SSH is now disabled by default in all present and future Raspbian OS releases.
Use the RPi configuration tool in [menu] --> [Preferences] or sudo raspi-config to enable SSH.

Re: SSH server closes connections

Posted: Wed Dec 14, 2016 1:36 pm
by Hirza_Tango
Ssh has been enabled, as evidenced by the fact that the log shows that a connection was established and the remote protocol version was given.

Re: SSH server closes connections

Posted: Sat Dec 17, 2016 1:25 am
by wh7qq
klricks wrote:SSH is now disabled by default in all present and future Raspbian OS releases.
Use the RPi configuration tool in [menu] --> [Preferences] or sudo raspi-config to enable SSH.
Yes, they "fixed" it so it doesn't work at all. Raspi-config, either command line or GUI is no help and putting in the /boot/ssh file per their blog does no good...so it is very safe indeed...you just can't use it. I think I still have the previous iso on another drive...will get it back and get rid of this garbage until the masters of the piniverse fix it so it can be used.

Edit:
After my previous tantrum, I went back and looked for my old version of jessie/pixel but I had already deleted it...so back to work. Not quite sure what fixed it but I am now able to login by ssh to this RPi. I did two things. First, I used the old linux/unix standby command "passwd" to enter a new password.

Code: Select all

passwd pi
I also logged in with

Code: Select all

ssh pi@localhost
with the new password. With that giving a happy result, I logged in using ssh on another RPi and then back to this one with the new password and all went well. I reiterate that the configuration utilities, either cli or GUI were useless to fixing this problem.

No apologies to the maintainers...to screw up a previously useable access without serious debugging/workarounds on a computer that is supposedly aimed at children and others with little experience...well, what can I say. This is a cluster-****.

Re: SSH server closes connections

Posted: Sat Dec 17, 2016 2:46 am
by klricks
wh7qq wrote:
klricks wrote:SSH is now disabled by default in all present and future Raspbian OS releases.
Use the RPi configuration tool in [menu] --> [Preferences] or sudo raspi-config to enable SSH.
Yes, they "fixed" it so it doesn't work at all. Raspi-config, either command line or GUI is no help and putting in the /boot/ssh file per their blog does no good...so it is very safe indeed...you just can't use it. I think I still have the previous iso on another drive...will get it back and get rid of this garbage until the masters of the piniverse fix it so it can be used.
Not sure what your issue is?
I tried all 3 enableing methods and they all work for me.

Re: SSH server closes connections

Posted: Sat Dec 17, 2016 9:13 am
by Hirza_Tango
SSH is enabled, that's not the problem. The port is identified in the log and by telnet as an SSH server

Re: SSH server closes connections

Posted: Sat Dec 17, 2016 10:34 am
by HawaiianPi
wh7qq wrote:Yes, they "fixed" it so it doesn't work at all. Raspi-config, either command line or GUI is no help and putting in the /boot/ssh file per their blog does no good...so it is very safe indeed...you just can't use it. I think I still have the previous iso on another drive...will get it back and get rid of this garbage until the masters of the piniverse fix it so it can be used...
It works perfectly for me by putting the "ssh" file into /boot. If it's not working for you then something is wrong on your end. Bad SD card? Bad imaging procedure? Not correctly creating the ssh file (having known file extension on Windows set to hidden, so that you don't see that the file you actually created is ssh.txt)?

Re: SSH server closes connections

Posted: Sat Dec 17, 2016 3:46 pm
by klricks
Hirza_Tango wrote:SSH is enabled, that's not the problem. The port is identified in the log and by telnet as an SSH server
After enabling of course I tested each case by connecting to the RPi using PuTTY from a Windows 10 computer.
I conneceted using IP address which I have reserved in my routers DHCP reservations table.

Re: SSH server closes connections

Posted: Sat Dec 17, 2016 4:11 pm
by jojopi
Loss of connection after "SSH2_MSG_KEXINIT sent" may be because the host keys are missing or corrupt. Try regenerating:

Code: Select all

sudo rm /etc/ssh/ssh_host_*
sudo dpkg-reconfigure openssh-server
Also, check for errors in /var/log/auth.log.

Re: SSH server closes connections

Posted: Thu Jan 05, 2017 9:54 am
by mattat01
jojopi wrote:Loss of connection after "SSH2_MSG_KEXINIT sent" may be because the host keys are missing or corrupt. Try regenerating:

Code: Select all

sudo rm /etc/ssh/ssh_host_*
sudo dpkg-reconfigure openssh-server
Also, check for errors in /var/log/auth.log.
This worked for me. Thanks!

Re: SSH server closes connections

Posted: Sun Aug 27, 2017 10:07 pm
by arastehfazel
jojopi wrote: Loss of connection after "SSH2_MSG_KEXINIT sent" may be because the host keys are missing or corrupt. Try regenerating:

Code: Select all

sudo rm /etc/ssh/ssh_host_*
sudo dpkg-reconfigure openssh-server
Also, check for errors in /var/log/auth.log.
I don't have my LCD working. And I need the ssh to fix my LCD .I mean I'm completely headless. The ssh file didn't work for me and raspberry closes the connection automatically. is there any way for me to try this solution?

Re: SSH server closes connections

Posted: Sun Feb 25, 2018 5:19 am
by jorgeg73
I am like you, ever found a solution?

Re: SSH server closes connections

Posted: Sun Feb 25, 2018 6:11 am
by jbudd
I am like you, ever found a solution?
The best way to get help is to start a fresh thread.
Describe your actual problem as it is now.

Are you really running Raspbian Jessie? Lots of things have changed since the original post in 2016, and the original poster has not been active in the forum since March 2017

Re: SSH server closes connections

Posted: Mon May 28, 2018 3:54 pm
by mikenike360
Here is a fix:

sudo rm /etc/ssh/ssh_host_*
sudo dpkg-reconfigure openssh-server