How to keep a ssh session alive (keeping the ssh terminal connected)
- July 10th, 2011
- By Paul Anthony Wilson
- Write comment
So you are tired of your ssh connection timing out making you have to log in again and again? Keeping the ssh session alive is not hard, but be aware that the session times out due to security reasons.
To keep the ssh session alive for only one user:
Edit your ssh config file at: ~/.ssh/config
sudo gedit ~/.ssh/config
then add the line: ServerAliveInterval 300
right at the end of the document, save and close.
To keep the ssh session alive for all users:
sudo gedit /etc/ssh/ssh_config
then add the line:
ServerAliveInterval 300
right at the end of the document, save and close.
This will cause the connected computer to send a data packet every 5 min to make sure the connected ssh terminal stays active.
