打开失败显示错误

Zac*_*ton 4 x11 opengl macos ssh terminal

每当我尝试通过 sshing 进入 Linux 服务器打开外部显示器时,都会遇到错误。该错误发生在各种情况下:

freeglut (./executable): 无法打开显示 'localhost:22.0' *与 openGL 链接的程序

(gedit:9741):Gtk-警告 **:无法打开显示:localhost:22.0

本质上,任何需要打开外部显示器的操作都会导致错误。网上查了一下,和显示变量有关,本来就是0:0。但是,我更改了本地 ~/.profile 以包含行 (DISPLAY=localhost:0.0; export DISPLAY),它显示了相同的错误,但使用 localhost:x:0 而不仅仅是 0:0。

我安装了 xquartz,并且使用 -Y 标志设置进行 sshing。我也尝试过 -X 标志,但仍然不走运。

dat*_*olf 5

Linux 系统上的 SSH 服务器也必须启用 X11 转发。在 /etc/ssh/sshd_config 中设置

X11Forwarding yes
X11UseLocalhost yes
Run Code Online (Sandbox Code Playgroud)

不要自己弄乱 DISPLAY 变量,SSH 服务器内部会处理正确的授权设置,并相应地设置 DISPLAY。