To increase the SSH idle timeout, follow these steps:
sudo nano /etc/ssh/sshd_config
ClientAliveInterval 120 ClientAliveCountMax 30
Here's what these values do:
ClientAliveInterval sets the timeout interval in seconds. If no data is received from the client within this interval, sshd(8) will send a message to request a response. The default is 0, which means no messages are sent. This option applies to protocol version 2 only.
ClientAliveCountMax determines the number of client alive messages that can be sent without sshd(8) receiving any messages back from the client. If this threshold is reached, sshd will disconnect the client, terminating the session. It's important to note that client alive messages are different from TCPKeepAlive. The client alive messages are sent through the encrypted channel and cannot be spoofed. The default value is 3. This option applies to protocol version 2 only.
ClientAliveInterval to 120 and
ClientAliveCountMax to 30, the idle timeout will be approximately 1 hour (60 minutes). After making the changes, you need to restart the SSH service for the modifications to take effect. Run the following command:
sudo service ssh restart