Pills: Tuning SSH config
I'm going to outline a couple must configurations I use in my
~/.ssh/config
:
Automatically close connections on network failures:
ServerAliveInterval 5 ServerAliveCountMax 1
This way SSH send an echo (a sort of ping) every 5 seconds, if didn't get a reply for "1" times it closes the connection.
But if you're stuck in a session for some reason, you can always just press the following keys in order:
<Enter>~.
.Set up usernames so you don't have to type
ssh username@company.com
all the time, but justssh company.com
:Host company.com User antonio # works with wildcards too Host *.company.com User antonio
just remember that rules are applied in order, so the first match wins. Run
ssh -v company.com
and you'll see something likedebug1: /home/antonio/.ssh/config line 4: Applying options for company.com
.