-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
通过启用 ControlMaster 可以实现 SSH 的复用, 开启后可以共享同一个 TCP 连接来建立多个 SSH 会话. 相比于每次都建立一个新的 ssh 连接, 省去了重复输入密码的过程.
可以在 ~/.ssh/config 中进行配置, 把这段配置加到最后:
Host *
ControlMaster auto
ControlPath ~/.ssh/%r@%h-%p
ControlPersist 600
man ssh_config
关闭 ssh 复用
应该可以使用 ssh -O exit [path] 关闭 ControlMaster
-O ctl_cmd
Control an active connection multiplexing master process. When the -O option is specified, the ctl_cmd argument is interpreted and passed to the master process. Valid commands are:check(check that the master process is running),forward(request forwardings without command execution),cancel(cancel forwardings),exit(request the master to exit), andstop(request the master to stop accepting further multiplexing requests).
问题
有时候会遇到 'UNIX_LISTENER TOO LONG FOR UNIX DOMAIN SOCKET' 这个问题, 这个应该是我们设定的 ControlPath 超长了.这个时候修改一下路径规则就可以了.
参考这个博客
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
