vnc 登录后只有终端 没有桌面 黑屏

1, start vnc server: vncserver :1

issue:

connect it with pc and only display one terminal.

2, stop vnc server: vncserver -kill :1

3, modify file(/home/your name/.vnc/xstartup) like below:

#!/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 &

verify vnc server works ok or not with step 1 and 2, if not go to next step.

4, modify file(/home/your name/.vnc/xstartup) like below:

#!/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-session &

verify vnc server works ok or not with step 1 and 2, if not go to next step.

5, modify file(/home/your name/.vnc/xstartup) like below:

#!/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 &
#gnome-session &

verify vnc server works ok or not with step 1 and 2, if not go to next step.

6, Bad luck, I do not know either. :)

ps: if you want to change the root content for every vnc server instance, you can try to modify below file:

/usr/bin/vncserver

$defaultXStartup 
= ("#!/bin/shnn". 
"# Uncomment the following two lines for normal desktop:n". 
"unset SESSION_MANAGERn". 
"exec /etc/X11/xinit/xinitrcnn". 
"#[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresourcesn". 
"#xsetroot -solid greyn". 
"#vncconfig -iconic &n". 
"#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &n". 
"#twm &n");

原文地址:https://www.cnblogs.com/cade/p/3491997.html