Recently, I found out that none of my friends with own servers knew about these three ssh configuration options, so I decided to collect them and share them with everyone. :)
Kill a hung SSH Sessions without closing the Terminal
I used to close hung up ssh sessions by closing the full terminal or terminal tab, too, but a few years ago, I found out there's a much better alternative. The ssh command line client actually has an escape sequence and then a few commands to control it! The magic key presses to close a session are: “⏎~.” (enter-tilde-dot). “⏎~” is the escape sequence, “.” is the command to terminate the session, and “⏎~?” shows all other available commands.
Check your SSH Fingerprints with ease using VisualHostKeys
One should compare one's SSH host key fingerprints, but most of the time, one just assume it's probably all right or checks the first and the last few characters, as comparing the fingerprint character by character is just too much work. Humans are much better at comparing visual patterns, though. Ever wondered what those „This is the key's random art“ with a strange ASCII art image when you generate a key are all about? Only recently I found out that they are a visual representation of the fingerprint intended for easy comparison by humans.
# Show random art of the host key on every login VisualHostKey yes
If you add this option globally to your
.ssh/config, ssh will show you the SSH host key fingerprint as random art every time you log in to a server. This will train you to the pattern, and after a few weeks, you'd notice that the pattern is different immediately.
Multiplex SSH Sessions for more Performance
You can easily boost the performance of transfers of many small files by adding this as a global options to your
.ssh/config. (Of course you could apply them to a few hosts only, too, but why should you?) This builds up only a single SSH connection to the target host and multiplexes all other ssh sessions to the same host over it. This also means that opening a second ssh session is almost instant.
# multiplex the connection when possible Controlmaster auto # location of the socket files Controlpath ~/.ssh/ssh-%r@%h:%p.sock # persist multiplex socket for 60 seconds when idle Controlpersist 60
In case the full session hung up, you need to delete
~/.ssh/ssh-<username>@<hostname>:<port>.sock though, or wait 60 seconds for the idle timer to time out.