Adding the following directives to your
.ssh/config should reduce your SSH connection establishment time significantly:
This works by having all SSH sessions sharing a single “control” connection.
ControlMaster auto directive tells OpenSSH client to start a control master if one is not already running, otherwise it will reuse a previous one.
ControlPersist yes directive tells the control master process to continue running in the background even though you’ve exited from the session, allowing subsequent sessions to reuse its connection.
ControlPath is the control socket rendezvous point for masters and slaves. If you’re on a shared host, you might want to set it to a private location such as in your
~/.ssh/ directory instead of
In my case, I stuck these into the wildcard
I’ve always known that OpenSSH had this functionality, but hadn’t bothered to try it out until now and it’s sooo very handy!