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


12

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

有任何想法吗?


1
它是否仅在一段时间不活动后才停止?它会在相同的时间后停止吗?SSH连接是否可能被其中一台计算机断开?
突破

显然它是在相同的时间后停止..
sencer

Answers:


12

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

Host *
    ForwardX11Trusted yes

您应该将*修改为某种主机模式,以免每个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.

1
不太麻烦的方法是在.ssh / config中为ForwardX11Timeout指定一个较大的值。从这里
Frepa
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.