SSH Multiplexing

Create a new file in ~/.ssh called config and insert the following:

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

Reuse an existing SSH connection when you connect to the same host multiple times. Be sure to chmod 600 the config file.

Update: This is also nice to add (not supported on all versions of ssh client), ControlPersist 4h


1 thought on “SSH Multiplexing

  1. also make sure to use -o ControlMaster=no when ssh tunneling. multiple tunnels won’t work over a shared socket

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s