网上好多解决办法都是改配置文件,到头来还是google出来解决问题,地址:
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-14-04
详细:
Since we are going to be changing how our VNC servers are configured, we’ll need to first stop the VNC server instance that is running on port 5901:
杀掉目前到vnc进程:
vncserver -kill :1
Before we begin configuring our new xstartup file, let’s back up the original in case we need it later:
备份:
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
Now we can open a new xstartup file with nano:
编辑xstartup
nano ~/.vnc/xstartup
Insert these commands into the file so that they are performed automatically whenever you start or restart your VNC server:
放到最下面:
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
最终是这个样子的:
root@interserver-kvm:~/.vnc# cat xstartup
#!/bin/sh
xrdb $HOME/.Xresources
startxfce4 &
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
unset DBUS_SESSION_BUS_ADDRESS
gnome-session –session=gnome-classic &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
#x-window-manager &
#gnome-session &