SSH Tricks

Re-use connections

When connecting to a host multiple times, you can re-use the first connection to speed up subsequent connections. This makes connecting many times faster.

ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p

On-the-fly port forwarding

657-guid

It is possible to add port forwarding on the fly without the need to open a new
terminal and ssh connection. ssh provides some escape characters to do some
stuff in your current connection.
In the default setup the basic escape character is ~ (you can specify this by
using EscapeChar in your configuration).

If you follow this by # character (and thus type ~#) you get a list of all
forwarded connections. Using ~C you can open an internal ssh shell that
enables you to add and remove local/remote port forwardings.