Increse Ubuntu SSH remote session time
sudo nano /etc/ssh/sshd_configApply below, if exist, change value, if not exist, add the line.
TCPKeepAlive no
ClientAliveInterval 30
ClientAliveCountMax 100Explain:
- TCPKeepAlive
Whether or not to send TCP “alive” message to the connecting clients to test for connection issues.
- ClientAliveInterval
A timeout interval to send encrypted alive message to clients if no data has been received from connection.
- ClientAliveCountMax
Number of times to send the encrypted alive message before disconnecting clients if no response are received.
What it basically means is that the server will not send the TCP alive packet to check if the client's connection is working, yet will still send the encrypted alive message every 30 seconds but will only disconnect after 50 mins of inactivity. Be sure to restart the SSH service after the reconfiguration. The following command would work for most Unix based servers;
Finally, reload ssh setting:
sudo service sshd restart