这是我的 ~/.vnc/xstartup 文件的内容:
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
/usr/bin/startkde &
Run Code Online (Sandbox Code Playgroud)
我的目标是登陆 KDE 桌面环境。我使用以下命令通过 ssh 启动 vnc 会话:
vncserver -geometry 1550x950
Run Code Online (Sandbox Code Playgroud)
但我登陆了 Gnome 桌面。我的配置有什么明显错误吗?
注意:我使用的是 Oracle Enterprise Linux 7。
你跑
exec /etc/X11/xinit/xinitrc
Run Code Online (Sandbox Code Playgroud)
它告诉系统“加载/etc/X11/xinit/xinitrc并通过启动该程序来覆盖此进程”。
从本质上讲,有两种可能的结果:
/etc/X11/xinit/xinitrc无法启动(因为它不存在,或者没有正确的权限位,或者诸如此类的原因)。您收到一条错误消息。如果您使用 运行脚本set -e(正如您应该做的那样),您的脚本也将退出。/etc/X11/xinit/xinitrc可以启动。您的程序结束,并xinitrc代替它运行。假设不是前者,这意味着您的脚本相当于:
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
Run Code Online (Sandbox Code Playgroud)
……没有别的了。
如果您想要 KDE 而不是 Gnome,那么您有两个选择:
exec电话线。这可能是更简单的选择。exec行(但为了清楚起见,请删除该行之外的所有内容),并配置默认的 X 配置,以便它启动 KDE 而不是 gnome。