If you put your computer to sleep (for example), an active ssh connection could be frozen (I do not know about the exact terms) in a terminal when you wake back your computer.
If it does, you could either close your terminal or if you value your current session you could force an immediate disconnection.
To force an immediate disconnection, press consecutively (not at the same time) the following three keys:
Enter, ~, .
(The ~ then . is the command to disconnect from the hung ssh session. The Enter however is here only to guarantee that the two characters are alone in on a new line that could have been dirty otherwise).
The session will eventually time out and disconnect; this will happen faster if you configure ServerAliveInterval and ServerAliveCountMax in ~/.ssh/config.
If you are tired of entering your credentials every time do the following:
- Create public/private key ;
- Share the pub key with the machines you want to be able to connect with to your host.
Check "Generating a new SSH key" chapter in Bash.md file.