I have a raspberry Pi running Debian Jessie. All use to work fine until 3 August. Since then I have been looking for answers and trying different suggestions but to no avail.

For some reason when I come in to work in the morning I am unable to remotely access my Pi server and I’m getting the following error.

Server unexpectedly closed network connection

During the day after a manual reset I can connect to my Pi server via Putty numerous times with out fail. FileZilla also connects with no problem during this time.

Then in the morning when I get to the office I try connecting via FTP with FileZilla and putty. Both give the same error. Then I go and reset the Pi server manually and all connections work. And then connection is possible from anytime of the day while I'm at work.

Then I did some research and one suggestion was that ssh times out so to fix this I added the following to the server ClientAliveInterval 120 and to the client ServerAliveInterval 120. This was added in the /etc/ssh/sshd_config file. Still does not solve the problem. I restarted ssh after I made the changes using

$ /etc/init.d/ssh restart

The other thing I found is that we now possibly have to many client pi’s running from the same server and to fix that I changed MaxStartups 10:30:60 to MaxStartups 100

With this problem now my scripts to update files on the Pi Clients don't run and don't update content.

With some more research I saw that one way that may help is to keep the session Alive by doing the following...

xserver-command=X -s 0 -dpms in file etc/lightdm/lightdm.conf

Well, this also didn't solve the problem.

Any theory that I can try will be appreciated.

  • Has anyone found a solution to this problem ​? – user72291 Aug 29 '17 at 7:20
  • You have so many SSH clients on an RPi that you had to increase MaxStartups to 100? Are you sure there are enough resources to support the workload? – Dmitry Grigoryev Aug 29 '17 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.