when someone abandons you,it is him that gets loss because he lost someone who truly loves him but you just lost one who doesn’t love you.
multiplexing 和独立会话的区别是,在服务器和客户端,都只看到一个进程(即使多次连接会话)
在服务器和客户机上,可以看到只打开了一个 TCP 连接,OpenSSH 使用现有的 TCP 连接实现多个 SSH 会话,降低新建 TCP 连接的负载
那么如何做到让 SSH 复用连接呢
通过 ControlMaster,ControlPath 和 ControlPersist 配置来实现,被复用的连接也可以叫主连接(master connection)
ControlMaster:允许通过单个网络连接共享多个会话
ControlPath:指定 control socket 的路径
配合以下参数食用:
ControlPersist:指定连接打开后,后台保持的时间
注意:在 ssh_config 关于 ControlMaster 的描述中,有一段令人迷惑的说辞
Additional sessions can connect to this socket using the same ControlPath with ControlMaster set to no (the default). These sessions will try to reuse the master instance's network connection rather than initiating new ones, but will fall back to connecting normally if the control socket does not exist, or is not listening.
❓“即使 ControlMaster 的值是 no,其他会话可以使用相同的 ControlPath 连接到此套接字”,这是为什么?
可能是因为 ControlMaster controls whether an ssh instance will be a control master, not whether it uses the control feature at all. If you want to disable the control feature for an ssh instance, set ControlPath to “none”.
be slow to promise and quick to perform.