Ubuntu: How do I change the default session for when using auto-logins?


When autologon is active, lightdm will start the Unity 3D session, not the 2D (or any other shell that I want to auto-login to).

Is there a way to start the shell I want automatically (autologon)?

Anyway, if autologon is disabled, the last used session is launched, and that's fine. I just want to choose which is default with autologon.


The list of sessions is described in the directory /usr/share/xsessions.

Some of the more common session names are as follows:

  • For unity-2d the session file is called ubuntu-2d.desktop
  • For gnome-classic the session file is called gnome-classic.desktop
  • For gnome-classic (no effects) aka gnome-fallback the session file is called gnome-fallback.desktop
  • For unity-3d the session file is called ubuntu.desktop
  • For Lubuntu the session file is called Lubuntu.desktop
  • For LXDE the session file is called LXDE.desktop

Thus, if you change the light-dm configuration file to "ubuntu-2d" this will default the session to Unity-2D


sudo nano /etc/lightdm/lightdm.conf  

change the line




Note - if you don't have a lightdm.conf file then for a autologin use the following values for this file:

[SeatDefaults]  greeter-session=unity-greeter  user-session=ubuntu-2d  autologin-user=myusername  autologin-user-timeout=0  

Another possibility is to run:

sudo /usr/lib/lightdm/lightdm-set-defaults -s <session-name>  


sudo /usr/lib/lightdm/lightdm-set-defaults -s ubuntu-2d  

This will also create the lightdm.conf file if it wasn't already present.


It is strange that LightDM (Ubuntu 11.10's display manager, which provides the graphical login screen) is not remembering your selection across reboots.

You can manually edit the relevant configuration file, which is called .dmrc and is located in your home folder. In Nautilus (the file browser), you'll have to press Ctrl+H (or View > Show Hidden Files) to see it and other files that start with a '.' character. If you have this file--which you probably do--then its contents will be like:

[Desktop]  Session=ubuntu

For GNOME Classic you can change it to say:

[Desktop]  Session=gnome-classic

Or for GNOME Classic (no effects) you can change it to say:

[Desktop]  Session=gnome-fallback

If you happened to want to use Unity 2D (session type Ubuntu 2D), you could change it to say:

[Desktop]  Session=ubuntu-2d

If you don't have the file at all, then you can create it with the appropriate contents.

If you want to set GNOME Classic or GNOME Classic (no effects) as the default session type for all users--or you'd prefer not to, but the above user-specific method doesn't work--then you can edit /etc/lightdm/lightdm.conf, changing the line that says user-session=ubuntu to instead say user-session=gnome-classic or user-session=gnome-fallback (or user-session=ubuntu-2d). A few things to keep in mind when considering doing this:

(1) It is preferable to edit the per-user configuration files in users' home folders, unless you have a reason to prefer changing the global configuration (like that not working).

(2) Since this is a global configuration file and it contains considerably more than the simple configuration option that you are intending to edit, it is advisable to back it up before editing it, in case you make a mistake. You can do that in the Terminal by running the command sudo cp /etc/lightdm/lightdm.conf /etc/lightdm/lightdm.conf.old.

(3) This file is owned by root, hence the sudo command above. You must also edit it as root. To open it in gedit as root, you can run gksu gedit /etc/lightdm/lightdm.conf (either in a Terminal window, or in the graphical Run Application text box, when you can get by pressing Alt+F2).

It seems likely that the behavior you're experiencing is a bug, so after gathering additional information by seeing if manually editing ~/.dmrc works, you may want to report it as one (read this carefully first, then after searching to see if a similar bug has been reported, initiate the reporting process by invoking ubuntu-bug with the PID of the running lightdm process, or, almost as good, run ubuntu-bug lightdm ...which should all make sense after you've read that guide).

By the way, besides Unity (session type Ubuntu), Unity 2D (session type Ubuntu 2D), and GNOME 3 Fallback (GNOME Classic and GNOME Classic (no effects)), you might also consider, as even lighter-weight options, Xfce4 (install the package xubuntu-desktop and select session type Xubuntu) and LXDE (install the package lubuntu-desktop and select session type Lubuntu).

There's also GNOME 3 with the GNOME Shell instead of Unity (install the package gnome-shell and select GNOME) and KDE 4 Plasma (install the package kubuntu-desktop and select Kubuntu), but those unlikely to be less resource-intensive than the above options.


To change the default Session in Lightdm

sudo /usr/lib/lightdm/lightdm-set-defaults --session gnome-shell  


to change the default per user, check


seems like this set's the .dmrc in the user home.



I edited /etc/lightdm/lightdm.conf with this content:

[SeatDefaults]  greeter-session=unity-greeter  user-session=gnome-shell  autologin-user=paul  

And it starts automatically to gnome-shell.


I find that setting any of the above is overridden by the users last session stored by lightdm. You may have to remove or edit the user files at /var/cache/lightdm/dmrc to enable the global default setting. Or on an individual basis by editing the user.dmrc file that has the following contents:

[Desktop]  Session=ubuntu  


This may not work in Ubuntu but it worked for me in Fedora. It took days to figure out and I wanted to share it:

Go to /usr/share/xsessions and /usr/share/wayland-sessions and add prefixes with a different number and a dash to every file ending in .desktop.
The lowest number will be the default. For example, I want xfce to be my default so that file is named 1-xfce.desktop

Hope this helps.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »