X11转发一段时间后停止工作

sen*_*cer 13 ssh cygwin x11-forwarding

我使用 Cygwin 通过 SSH 连接一个 linux 机器(ubuntu 服务器 12.04),并使用 X11 转发。每次我 ssh 时,我都可以使用 X 转发一段时间然后它停止工作(例如 gvim 说无法打开显示)。如果我退出并重新 ssh,它会再次开始工作。并在一段时间后再次停止。

有任何想法吗?

Hep*_*ite 14

当我遇到这个问题时,我发现我需要将这些行添加到~/.ssh/config

Host *
    ForwardX11Trusted yes
Run Code Online (Sandbox Code Playgroud)

您应该将 * 修改为某种主机模式,这样就不会为每个 ssh 连接启用它。

您可能希望改为更改 ForwardX11Timeout 选项。来自man ssh_config

 ForwardX11Timeout
    Specify a timeout for untrusted X11 forwarding using the format
    described in the TIME FORMATS section of sshd_config(5).  X11
    connections received by ssh(1) after this time will be refused.  The
    default is to disable untrusted X11 forwarding after twenty minutes has
    elapsed.

 ForwardX11Trusted
    If this option is set to “yes”, remote X11 clients will have full
    access to the original X11 display.

    If this option is set to “no”, remote X11 clients will be considered
    untrusted and prevented from stealing or tampering with data belonging
    to trusted X11 clients.  Furthermore, the xauth(1) token used for the
    session will be set to expire after 20 minutes.  Remote clients will
    be refused access after this time.
Run Code Online (Sandbox Code Playgroud)