Can I set a default user in lightdm?

I've been playing with Ubuntu Oneiric on my netbook (where breakage isn't really a concern); I like the new lightdm login screen, but it has one minor annoyance: in addition to my own user account, there's another account for occasional use by my girlfriend, and her user account is the one that's always focused (presumably because it's first alphabetically).

I know how to fix this in gdm but haven't found a solution for lightdm. Does anyone know how to set it up so my account is highlighted by default?


Solution 1:

In /etc/lightdm/lightdm.conf

Go down the file until you get to:

# greeter-hide-users=false

Un-comment it, make sure the value is false.

Solution 2:

hackerb9's answer did it for me, but rather than creating a script, it's much simpler to simply "freeze" the config file. Here's what to do:

  • Open the config file for editing (note that depending on the flavor of Ubuntu you're using, the folder inside .cache might be called something else)
    sudo nano /var/lib/lightdm/.cache/lightdm-gtk-greeter/state
  • Edit the following line to reflect the default user's account name
    last-user=[DEFAULT-USER]
  • Perhaps it would be good to also add a comment to the file stating that it is locked and how
  • Run the following command to "freeze" the file so it can't be changed by lightdm
    sudo chattr +i /var/lib/lightdm/.cache/lightdm-gtk-greeter/state

Now lightdm won't be able to update this file when a different user logs in ensuring that your default user will always be listed when the login screen loads.

If this works for you, and you decide to up-vote, please up-vote hackerb9's post as well as this is a derived by separate method.