Re:Getting Comfortable With SSH
by leif on Saturday February 05, 2011 @01:52PM
(#2183699)
One of the most impressive SSH tricks I've seen is the ControlMaster option. It saves your authentication information on a per-(user, host) basis, which lets you share one connection among multiple ssh/scp/rsync commands and TRAMP sessions. This is less useful if you use passwordless keys or ssh-agent (please use ssh-agent), but becomes much more useful if the host you connect to doesn't support key-based auth.
Other useful things in my .ssh/config, check the manpages before you use them:
[ Parent
| on HN ]
Re:Getting Comfortable With SSH
by mcmatterson on Saturday February 05, 2011 @02:10PM
(#2183758)
For reasons others on this thread have outlined, ControlMaster is often more trouble than it's worth for general-purpose SSH usage. However for use in automated tools, it's a lifesaver. I use it extensively in doo for that exact reason:
I have a pretty awesome script that uses control-master to allow me to type the password in once and then preform a bunch of actions. The script specifically is for boot strapping ssh authorized keys on boxes that can't be on puppet.
I'd rather use ssh-agent for day to day work but this is a useful trick for scripting.
Re:Getting Comfortable With SSH
by jcsalterego on Saturday February 05, 2011 @01:58PM
(#2183716)
The only issue I had with ControlMaster, IIRC, was that when I killed the original connection, it would take everything else down with it.
There's a good chance I was just doing it wrong™ though.
The behavior I've seen is that when you log out, the process doesn't end until all other clients to the connection have exited. I've observed what you describe if I then ^C it.
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.
Re:Getting Comfortable With SSH
by jcsalterego on Saturday February 05, 2011 @02:08PM
(#2183750)
That sounds about right.
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.
Ahh, then you want to learn about emacs --daemon and emacsclient. :-)
> CompressionLevel 9
Just one note regarding the above line: this only works with SSH version 1. This functionality was removed in version 2 of the protocol (in the newer version there is only a single default compression level).