How to prevent SSH from timing out on linux

You can do it on client side or server side.

Client side

Edit /etc/ssh/ssh_config, and add the following line to the end of the file:

ClientAliveInterval 60

Server side

Edit /etc/ssh/sshd_config,and add the following line to the end of the file:

ServerAliveInterval 60

after edit the file, restart sshd service:

systemctl restart ssh
Posted on 2022-03-25