【问题标题】:X11 Forwarding using Cygwin ssh got port 6000 Connection refused使用 Cygwin ssh 进行 X11 转发得到端口 6000 连接被拒绝
【发布时间】:2018-07-07 23:55:06
【问题描述】:

我尝试使用 Windows 10 机器作为客户端和 Ubuntu Linux 机器作为服务器转发 X11。 ssh 在 Cygwin 下运行,其中包含 xinit 和 xorg。步骤:

  1. 开启 linux 服务器机器。
  2. 我使用 sshd_config 配置文件在客户端和服务器端都启用了转发。
  3. 我通过执行以下命令在 Cygwin 中设置显示: 导出显示=r1:0.0 其中 r1 是服务器的名称
  4. 我在服务器端启用了访问列表: xhost 192.168.1.143
  5. 使用 ssh 从 Cygwin 连接到服务器。
  6. 运行 lxterminal 应用程序,但得到:
r1@r1:~$ lxterminal    
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from 127.0.0.1 37184
connect r1 port 6000: Connection refused

r1 服务器端口 6000 是否被拒绝?如果是,怎么会?

【问题讨论】:

    标签: ubuntu cygwin portforwarding openssh ssh-tunnel


    【解决方案1】:

    来自 xorg-server-*1.17.4-1 cygwin 公告

    https://sourceware.org/ml/cygwin-announce/2015-10/msg00111.html

    '-nolisten tcp' 现在是默认的,所以服务器只接受本地 Unix 域套接字上的连接。添加了“-listen”选项 可用于恢复以前的行为。

    我猜Linux服务器上也发生了同样的事情

    【讨论】:

    • 你好,根据link,设置DISPLAY变量,启用xhost,并使用ssh -Y选项是“nolisten tcp”的解决方案。我这样做了,但仍然有问题
    【解决方案2】:

    我使用的是 Ubuntu 20.04。我也无法连接到端口 6000。

    最终起作用的是这个 hack:

    sudo vi /usr/bin/Xorg
    

    并将-listen tcp 添加到 Xorg 命令:

    #exec "$basedir"/Xorg.wrap "$@"
     exec "$basedir"/Xorg.wrap "$@" -listen tcp
    

    然后保存退出文件并重启用户图形界面:

     sudo service gdm restart
    

    然后检查 6000 端口是否打开:

     nmap localhost
    

    【讨论】:

      猜你喜欢
      • 2019-05-16
      • 2017-04-27
      • 1970-01-01
      • 2019-08-22
      • 2015-02-01
      • 2018-10-15
      • 2018-09-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多