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?


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


#Uncommment this line if using Gnome and your keyboard mappings are incorrect.

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

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 
  • 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. – Roger Smith Oct 2 '13 at 8:54
  • Did you remember to make the ~/.vnc/xstartup file executable e.g. chmod u+x ~/.vnc/xstartup? – steeldriver Oct 2 '13 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. – Roger Smith Oct 2 '13 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. – steeldriver Oct 2 '13 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? – Roger Smith Oct 2 '13 at 13:00

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.