无法在 CentOS 6 上启动远程 GUI 程序

San*_*dra 1 linux centos

我已经设置ForwardX11 yes/etc/ssh/ssh_config其中通常使我能够通过以下方式在 CentOS5 上打开 GUI 程序ssh -X server

但是在 CentOS6 上做同样的事情我得到了

# firefox -no-remote
Error: no display specified
# 
Run Code Online (Sandbox Code Playgroud)

可能有什么问题?

更新

已经尝试过以下

# firefox -no-remote
Error: no display specified
# echo $DISPLAY

# export DISPLAY=localhost:0.0
# echo $DISPLAY
localhost:0.0
# firefox -no-remote
Error: cannot open display: localhost:0.0
# 
Run Code Online (Sandbox Code Playgroud)

更新 2

~$ echo $DISPLAY
:0.0
~$ export DISPLAY=localhost:0.0
~$ ssh -X root@net2
[root@net2 ~]# xclock 
Error: Can't open display: 
[root@net2 ~]# 
Run Code Online (Sandbox Code Playgroud)

gkd*_*dsp 10

把ForwardX11改成yes后,有没有重启sshd服务器?也就是说,通过键入:

# /etc/init.d/sshd restart 
Run Code Online (Sandbox Code Playgroud)

您也可以尝试先让 xclock 等更简单的东西工作,以确定它是否与 firefox 相关(至少证明您的远程 X11 工作正常)。

# /usr/bin/xclock &
Run Code Online (Sandbox Code Playgroud)

您可能需要先安装它。

# yum install xorg-x11-xauth
Run Code Online (Sandbox Code Playgroud)

安装 xorg-x11-xauth 后,退出 X11 窗口,然后像上面一样重新登录。然后你可以这样做:

# yum install xclock
# /usr/bin/xclock &
Run Code Online (Sandbox Code Playgroud)

您可能还需要使用 xhost。我相信它在 xorg-x11-server-utils 里面。

# yum install xorg-x11-server-utils
# xhost + enter.your.server.address.com
Run Code Online (Sandbox Code Playgroud)

如果这对您有用,那么这是 Firefox 设置问题。这可能是您需要绕过的安全相关问题,才能让 Firefox 像您尝试的那样远程工作。我记得必须在 Firefox 内部设置一些东西,以便在您尝试时通过 SSH 远程访问它。最后它用起来太慢了(在我开始工作后),我放弃了使用它。