[CentOS] vncserver does not start gnome-sessioin automatically

Thu Mar 27 07:07:01 UTC 2014
Miranda Hawarden-Ogata <hawarden at ifa.hawaii.edu>

On 2014/03/26 17:26, Yawei Guo wrote:
> I installed RHEL 5.8 x86_64 today. To my surprise, when I connect it using
> vnc viewer it does not start gnome-session automatically.
>
> The last line in .vnc/xstartup is twm&
>
> Before I removed RHEL 6.1 a few days ago, vncserver always starts
> gnome-session every time I open vncviewer.
>
> Is that related to RHEL version or vnc-server version?
>
> Best Regards,
> Yawei
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
As far as I recall, on my 4.x, 5.x, and 6.x centos boxes, I always had 
to replace the default xstartup file with a custom one to call the 
session type desired for that user.

If you want kde, use "startkde" in the file. For gnome, use 
"gnome-session &".

I believe "startx" just fires up whichever desktop is the default for 
the window manager the box is using. So ignore any website that tells 
you using startx will start gnome, that will only work IF the box 
running the vnc-server has gdm as its window manager. If it has kdm, 
startx will start kde.

For the file itself, you can delete everything except the #!/bin/sh and 
then put the desktop call on the next line. If you want to get fancy and 
have terminals or something else run by default, you'd add that in above 
the desktop call. My personal file looks like this:

#!/bin/sh
gnome-session &

Hope that helps.

Miranda