我的 ~/.ssh/config 包含:
ControlMaster auto
ControlPath ~/.ssh/socket-%r@%h:%p
Host hostname.example
# TextMate rmate port
RemoteForward :52698 localhost:52698
Run Code Online (Sandbox Code Playgroud)
当我与主机建立初始连接时,它成功创建了位于 的主套接字文件~/.ssh-lachlanhunt@hostname.example:22。
但是当我打开一个新终端并尝试建立第二个连接时,我收到此错误:
$ ssh hostname.example
mux_client_forward: forwarding request failed: remote port forwarding failed for listen port 52698
muxclient: master forward request failed
ControlSocket /Users/lachlanhunt/.ssh/socket-lachlanhunt@hostname.example:22 already exists, disabling multiplexing
Warning: remote port forwarding failed for listen port 52698
Run Code Online (Sandbox Code Playgroud)
但是,如果我注释掉RemoteForward配置中的行,它就能够成功地重用连接,从而使其连接速度更快。有什么方法可以配置 ssh 以支持多路复用连接并启用远程端口转发,这样它仅在主连接时尝试转发端口?
我的系统: