-
VNC xstartup程序中默认的设定值是启动twm,而不是GNOME或KDE。默认的配置文件在第一次启动vncserver之前,运行vncpasswd命令创建密码的时候生成在用户的家目录中: ${HOME}/.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 & xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &twm &为了启动GNOME或者KDE,先去掉“unset SESSION_MANAGER“和”exec /etc/X11/xinit/xinitrc“这两行的注释,然后将twm&注释掉,最后添加“gnome-start”,其设置如下:#!/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 & xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" twm &gnome-start & 类似的,如果要启动KDE,需要修改为:#!/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 & xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" twm &startkde &修改配置文件后,关闭所有客户端vncviewer连接,然后重启动VNC,GNOME或KDE即已做为默认桌面。