复制代码代码如下: Linux/mac下，在$HOME/.ssh/config中加入 Host * ControlMaster auto ControlPath <a>/tmp/ssh-%r@%h</a>
man ssh_config 5
复制代码代码如下: ControlPath Specify the path to the control socket used for connection sharing as described in the ControlMaster section above or the string “none” to disable connection sharing. In the path, ‘%l’ will be substituted by the local host name, ‘%h’ will be substituted by the target host name, ‘%p’ the port, and ‘%r’ by the remote login username. It is recommended that any ControlPath used for opportunistic connection sharing include at least %h, %p, and %r. This ensures that shared connections are uniquely identified.