This tip is for when your SSH connection is being flooded (perhaps you accidentally ran
cat /dev/rand or something) and your
^C presses don't seem to be getting through.
If this ever happens to you, you can simply type
<enter>~. to abort the connection. This will always work because that key sequence is sent to your local SSH client process, not to the server.
~ (tilde) is the SSH's default
EscapeChar. You press
<enter> first to clear the buffer, the
~ escape char and any one of a number of options.
For example, the full list of options that the client of my version of OpenSSH supports is (gotten with
Supported escape sequences:
~. - terminate connection (and any multiplexed sessions)
~B - send a BREAK to the remote system
~C - open a command line
~R - Request rekey (SSH protocol 2 only)
~^Z - suspend ssh
~# - list forwarded connections
~& - background ssh (when waiting for connections to terminate)
~? - this message
~~ - send the escape character by typing it twice