Ubuntu: Can I set a default user in lightdm?

Question:

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

Edit the file /etc/lightdm/lightdm.conf (gksu gedit /etc/lightdm/lightdm.conf) and add a line like this at it:

default-user=sean_fitzpatrick

Solution:2

The "default-user" option has been removed from lightdm. Why? Nobody knows. It's been five years since this question was originally asked and it's still broken. Lightdm now saves the state of who last logged in in a hidden file here:

/var/lib/lightdm/.cache/lightdm-gtk-greeter/state

So, here's a three step workaround:

Create a shell script called /usr/local/bin/lightdm-default-user with the following contents:

#!/bin/sh # LightDM removed the default-user option. # The only recourse now is an ugly kludge. # Note that if you want to default to the "Guest Session", # you need to specify the last user as "*guest". /bin/echo -e '[greeter]\nlast-user=*guest' > /var/lib/lightdm/.cache/lightdm-gtk-greeter/state

Make it executable: chmod 755 /usr/local/bin/lightdm-default-user

Have lightdm automatically run the script upon start up by editing /etc/lightdm/lightdm.conf and adding a line in the [SeatDefaults] section:

This is horrifically ugly but it is, unfortunately, the best solution at the moment.

Solution:3

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:4

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 namelast-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 lightdmsudo 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.

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