[ubuntu]ubuntu安装vncserver后,windows连接灰屏解决方法

#!/bin/bash
export $(dbus-launch)
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
# [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
# [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &

VNCSERVERS="2:root" VNCSERVERARGS[1]="-GEOMETRY 800×600"

tightvncserver -kill :1

tightvncserver :1

此时你会发现,虽然登录后桌面显示正常,但一旦关闭窗口,画面又会变回灰色。

这其实是正常现象,因为 tightvncserver 并未与系统的主图形界面共用同一套图形环境。你只需点击左上角的“应用程序”或“位置”菜单,即可正常打开文件管理器或其他程序。