How to keep your SSH session alive (Linux, Mac)

When you are working remotely, sometimes you can see that your ssh session is automatically disconnected after the idle time, if you want to keep the connection alive, do as follow:

1. Open terminal
2. Edit ssh_config

sudo nano /etc/ssh/ssh_config

3. Add the following line to the end of the file

ServerAliveInterval 5

4. Ctrl+X and enter y to save the files

5. You are done!

You can change 5 to any number, here 5 is the number of seconds for the clients to sends a small keep-alive packet to the server so that the connection is not disconnected.

Hope this help!

Related posts:

Share

About number.0