M
M
memradar2019-12-29 17:34:34
SSH
memradar, 2019-12-29 17:34:34

How to solve the problem, the error "remote side unexpectedly closed network connection" crashes when working through putty via ssh?

There is docker ubuntu 18.04.3 LTS (GNU/Linux 4.2.8 armv71). When connected via putty to the ssh server, 10-15 seconds pass and the error "remote side unexpectedly closed network connection" appears.
5e08b92ce94af328515702.png
I look at the server with the sudo ssh status command, ssh is not working (:
5e08b94d02dcd030270472.png
The sudo /etc/init.d/ssh restart command helps
After this command, everything seems to be fine:
5e08b95fc3d41513624625.png
If the docker is rebooted, the server works, but after the first connection via ssh everything repeats:- (
Output of #journalctl -u ssh , and its last result:
Dec 29 15:32:46 ubuntu-bionic-armhf-1 systemd[1]: Started OpenBSD Secure Shell server.
Dec 29 15:33:17 ubuntu-bionic- armhf-1 systemd[1]: ssh.service: Main process exited, code=killed, status=9/KILL
Dec 29 15:33:17 ubuntu-bionic-armhf-1 systemd[1]: ssh.service: Failed with result 'signal'.

Dec 29 15:33:17 ubuntu-bionic-armhf-1 systemd[1]: ssh.service: Service hold-off time over, scheduling restart.
Dec 29 15:33:17 ubuntu-bionic-armhf-1 systemd[1]: ssh.service: Scheduled restart job, restart counter is at 4.
Dec 29 15:33:17 ubuntu-bionic-armhf-1 systemd[1 ]: Stopped OpenBSD Secure Shell server.
Dec 29 15:33:17 ubuntu-bionic-armhf-1 systemd[1]: Starting OpenBSD Secure Shell server...
Dec 29 15:33:17 ubuntu-bionic-armhf-1 sshd[454]: Server listening on 0.0 .0.0 port 2222.
Dec 29 15:33:17 ubuntu-bionic-armhf-1 sshd[454]: Server listening on :: port 2222.
Dec 29 15:33:17 ubuntu-bionic-armhf-1 systemd[1]: Started OpenBSD Secure Shell server.
Dec 29 15:33:49 ubuntu-bionic-armhf-1 systemd[1]: ssh.service: Main process exited, code=killed, status=9/KILL
Dec 29 15:33:49 ubuntu-bionic-armhf-1 systemd[1]: ssh.service: Failed with result 'signal'.

Dec 29 15:33:49 ubuntu-bionic-armhf-1 systemd[1]: ssh.service: Service hold-off time over, scheduling restart.
Dec 29 15:33:49 ubuntu-bionic-armhf-1 systemd[1]: ssh.service: Scheduled restart job, restart counter is at 5.
Dec 29 15:33:49 ubuntu-bionic-armhf-1 systemd[1 ]: Stopped OpenBSD Secure Shell server.
Dec 29 15:33:49 ubuntu-bionic-armhf-1 systemd[1]: Starting OpenBSD Secure Shell server...
Dec 29 15:33:49 ubuntu-bionic-armhf-1 sshd[456]: Server listening on 0.0.0.0 port 2222.
Dec 29 15:33:49 ubuntu-bionic-armhf-1 sshd[456]: Server listening on :: port 2222.
Dec 29 15:33:49 ubuntu-bionic-armhf-1 systemd[1]: Started OpenBSD Secure Shell serv
On the advice of @pfg21 I tried the following options in /etc/ssh/sshd_config on the server
TCPKeepAlive yes
ClientAliveInterval 60
ClientAliveCountMax 360
does not help....
How to solve this problem so that sshd does not crash and works stably. Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
memradar, 2019-12-29
@memradar

Solution:
In sshd.service

$sudo nano /etc/systemd/system/sshd.service

you need to set the key in the [Service] section to:
problem solved and don't forget to reload all these wonders:
$sudo systemctl daemon-reload
$sudo /etc/init.d/ssh restart

P
pfg21, 2019-12-29
@pfg21

throw more shutdown intervals
i.e. write the following parameters to /etc/ssh/sshd_config on the server
TCPKeepAlive yes
ClientAliveInterval 60
ClientAliveCountMax 360

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question