使用ControlMaster以机会方式与用户@主机共享第一个ssh连接

我在ssh_config手册页中看到,您可以使用ControlPathControlMaster共享与host@user连接。
对于本地用户,远程用户和远程主机的每个组合,有没有办法机会性地做到这一点? 因此第二次ssh进入testuser@remotelaptop的第一次连接是第一次连接而第一次仍在运行?

(我使用ssh密钥。我不确定这是否会使它更容易或更难)。

ssh_config手册页:

 ControlMaster ... Two additional options allow for opportunistic multiplexing: try to use a master connection but fall back to creating a new one if one does not already exist. These options are: “auto” and “autoask”. The latter requires confirmation like the “ask” option. 

因此,如果您使用ControlMaster auto配置ssh,它将尝试连接以使用现有的SSH会话,如果失败则返回创建新的主连接。

所以像下面这样的配置可能就是你所追求的:

 ControlMaster auto ControlPath ~/.ssh/control/%r@%h:%p