1)Dealing with the client side
First of all, to deal on the client side /etc/ssh/ssh_config
or ~/.ssh/config
to describe the contents of two following.
$ vim ~/.ssh/config ServerAliveInterval 15 ServerAliveCountMax 10
With this setting, we send an acknowledgment ten times to the server every 15 seconds, and
if there is no response timeout occurs.
2)Dealing with the server side
Next, on the server side, there is a corresponding way, but /etc/ssh/sshd_config
to
$ vim / etc / ssh / sshd_config ClientAliveInterval 30 ClientAliveCountMax 5
If you write it, it sends an acknowledgment five times to the client every 30 seconds,
but if there is no response it will time out.
reference:
https://qiita.com/ysk24ok/items/2f4ced5edf306fdd9dfb