May 3, 2024

How to Keep SSH Connections Alive on Mac

Posted December 9, 2021 at 5:45am by iClarified · 20455 views
These are instructions on how to prevent timeout and keep SSH connections alive on Mac.

Step One
Launch Terminal from your Applications > Utilities folder.


Step Two
Execute the following command into the Terminal window...

sudo nano ~/.ssh/config


Enter your administrative user password when prompted.


Step Three
Add the following line to your ssh config file.

ServerAliveInterval 100


Step Four
Press Control+x to exit, then press Y when prompted to save changes.


Step Six
Press Return to confirm the filename and exit.




New SSH connections should now stay open indefinitely. You can shorten or lengthen the interval as required by your server.