12

On my system I will use VNC to login. But at this time, after connect to the pc, I get the automatic login with unity desktop. What I have to do, to have gnome desktop on VNC connection instead of unity?

2 Answers 2

10

It should be sufficient to create a suitable ~/.vnc/xstartup file in your account on the remote host, including the line

gnome-session --session=your-preferred-session &

For example, a minimal file for a gnome-classic session might be

#!/bin/sh

#Uncommment this line if using Gnome and your keyboard mappings are incorrect.
#export XKL_XMODMAP_DISABLE=1

# Load X resources (if any)
if [ -r "$HOME/.Xresources" ]
then
        xrdb "$HOME/.Xresources"
fi

gnome-session --session=gnome-classic &

The text of your-preferred-session will depend on what desktop packages you have installed - which you can check by looking in the /usr/share/xsessions directory i.e.

$ ls /usr/share/xsessions/
awesome.desktop        gnome-classic.desktop  gnome-fallback.desktop
gnome.desktop          gnome-shell.desktop     ubuntu-2d.desktop     xfce.desktop

The xstartup file can also be used to start non-gnome desktop sessions, for example

if which startxfce4 > /dev/null; then
    exec startxfce4 
fi
12
  • Thanks steeldriver, but it isn´t working. I have still unity on vnc sessions. All gnome packages are installed. I think, maybe the "HOME" variable will not set. Oct 2, 2013 at 8:54
  • Did you remember to make the ~/.vnc/xstartup file executable e.g. chmod u+x ~/.vnc/xstartup? Oct 2, 2013 at 10:29
  • Yes, it is executable. But i saw after logout from the local desktop session - for very short time - following: "vncserver: the HOME environment variable is not set". And now i cannot shutdown or reboot the host directly from graphical login screen or when i am logged in via vnc. I must login first local to shutdown the machine. Oct 2, 2013 at 11:26
  • Hmm... never seen that error before - what vncserver are you running and how did you install / configure it? How are you invoking it? FWIW think it's normal not to be able to shut down from the GUI when other sessions are active. Oct 2, 2013 at 11:36
  • I am using tightvnc. I installed it over the synaptic package manager. Starting it in the /etc/rc.local with following param: su -c "/usr/bin/vncserver -geometry 1280x1024 -depth 24" roger Unfortunatelly i can´t check the log with the message about, because i can´t find the log which was displayed after logout. Maybe do you known which log this is? Oct 2, 2013 at 13:00
0

Try using --replace in xstartup with the session you want to use. It works on Fedora.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .