In the unlikely event of receiving a phone call while editing from remote an important config file with vi, you surely have experienced that PUFF! your connection to the server is stuck, your file is stuck as well, and all your editings are lost.
To avoid such events, don’t forget to create a simple config file into the .ssh directory of your user, and set it as follows to keep ssh sessions alive:
$ vi ~/.ssh/config Host * ServerAliveInterval 60
Don’t forget to set the proper permissions or ssh will stop working:
$ chmod 600 ~/.ssh/config