【问题标题】:X11 forwarding requested but DISPLAY not set已请求 X11 转发,但未设置 DISPLAY
【发布时间】:2020-12-16 22:34:03
【问题描述】:

我想在连接到 Jetson Xavier nx 的 macOS 上启用 x11 转发。但是,在连接时:

sudo ssh -Xvvv id@host

连接建立成功。但在详细日志中,我得到以下信息:

debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
debug3: receive packet: type 52
debug1: Authentication succeeded (password).
Authenticated to proto1 ([192.168.1.106]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting no-more-sessions@openssh.com
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: exec
debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug1: X11 forwarding requested but DISPLAY not set
debug2: fd 4 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x48
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug1: Sending environment.
debug3: Ignored env TERM
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env PATH
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env HOME
debug3: Ignored env MAIL
debug3: Ignored env LOGNAME
debug3: Ignored env USER
debug3: Ignored env SHELL
debug3: Ignored env SUDO_COMMAND
debug3: Ignored env SUDO_USER
debug3: Ignored env SUDO_UID
debug3: Ignored env SUDO_GID
debug3: Ignored env __CF_USER_TEXT_ENCODING
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0

X11 forwarding requested but DISPLAY not set

为了使 X11 转发工作,必须在连接时设置 DISPLAY 变量。像这样手动设置显示:

export DISPLAY=http://localhost:22

也不行。如何开启 X11 转发?

【问题讨论】:

    标签: ubuntu x11 nvidia-jetson


    【解决方案1】:

    那里绝对不应该有http://,而且我认为您的:22 来自SSH 端口,而不是您应该使用的X11 显示号码。您在本地机器上的 DISPLAY 几乎总是 :0.0,如果您在机器上 echo $DISPLAY 时还没有看到它,那么那里可能有问题。

    确保您可以先在 Mac 上单独运行 X11 应用程序。您可能需要安装XQuartz

    尝试不使用sudo 运行;也许 root 不允许在 Mac 上与您的 X11 交谈。另外,也许可以在xterm 窗口中尝试ssh -X(当您手动打开 XQuartz 或可从其菜单启动时,该窗口应该会打开)以确保它选择正确的 DISPLAY。

    【讨论】:

      【解决方案2】:

      我在尝试将 X11 转发到 XQuartz 时遇到了同样的问题。我相信当你从 Mac ssh 时,如果 Mac 终端中的 DISPLAY 没有设置,那么 ssh 客户端不知道将 X11 流量转发到哪里。所以我就这么做了:

      DISPLAY=:0
      

      在 Mac 终端中,然后 ssh -X 并且它工作了。

      【讨论】:

      • 这行得通。通过比较XQuartz终端和iterm2或Mac OS默认终端环境的环境(env命令)可以看出。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-10-15
      • 2011-07-10
      • 1970-01-01
      • 1970-01-01
      • 2020-09-27
      • 2017-10-21
      • 2016-06-05
      相关资源
      最近更新 更多