by leif · 15y ago · 0 comments
# multiplex connections to one host
ControlMaster auto
# where is that file
ControlPath ~/.ssh/master-%r@%h:%p
Other useful things in my .ssh/config, check the manpages before you use them: # use compression
Compression yes
# really really compress it
CompressionLevel 9
# forward X stuff
ForwardX11 yes
# yes, really forward X stuff
ForwardX11Trusted yesI'd rather use ssh-agent for day to day work but this is a useful trick for scripting.
There's a good chance I was just doing it wrong™ though.
The way I usually do it is by opening something over TRAMP before opening any other ssh windows. That way, Emacs will handle the connection maintenance and I don't really need to see that it's up. If it dies, I just try saving something and it'll re-establish the connection.
If you don't use Emacs, you can always just start a dummy connection first and minimize/disown it.
Good tip about TRAMP, although I tend to exit out of my emacs sessions frequently. For my long running ssh tunnels, I just screen them.