每当我尝试通过 sshing 进入 linux 服务器打开外部显示器时,我都会遇到错误。该错误发生在各种情况下:
freeglut (./executable): 无法打开显示 'localhost:22.0' * 程序与 openGL 链接
(gedit:9741): Gtk-WARNING **: 无法打开显示: localhost:22.0
基本上任何需要打开外部显示器的东西都会导致错误。网上查了一下,跟display变量有关系,原来是0:0。但是,我更改了本地 ~/.profile 以包含显示相同错误的行 (DISPLAY=localhost:0.0; export DISPLAY),但使用 localhost:x:0 而不仅仅是 0:0。
我已经安装了 xquartz,并且我设置了 -Y 标志。我也试过 -X 标志,但仍然不走运。
最佳答案
Linux系统上的SSH服务器也必须开启X11转发。在/etc/ssh/sshd_config 设置
X11Forwarding yes
X11UseLocalhost yes
不要自己弄乱 DISPLAY 变量,SSH 服务器在内部处理正确的授权设置,并将相应地设置 DISPLAY。
关于macos - 无法打开显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22314995/