I'm using Ubuntu 18.04 LTS to SSH into my Linux machine at work from my Windows computer, but after inactivity (either working on something else for a time, or, more annoyingly, running a command which takes a long time), the connection is reset.

The message I get is Connection reset by port 22.

How can I stop this from happening?

  • 3
    There reset is from the server side.
    – Pilot6
    Jun 3 '20 at 19:38

Look in /etc/ssh/sshd_config on the linux server.

You can change the values of ClientAliveCountMax and ClientAliveInterval to prevent it from disconnecting.

You will need root access, and after changing values you will need to systemctl restart sshd

Be careful if you have an invalid sshd_config and restart sshd you may need console access.

Alternatively some SSH clients can send characters automatically to the server to keep it from disconnecting.

You can also learn tmux, which is a great tool for preventing issues of losing work.

  • I don't have root access. How can I get it to send characters automatically. And what is tmux? Jun 6 '20 at 13:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.