Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Solved] How to display default user in Lightdm on login?

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
M22
Posts: 29
Joined: 2024-01-28 07:35
Been thanked: 2 times

[Solved] How to display default user in Lightdm on login?

#1 Post by M22 »

Hi,

I'm using XFCE, and have created a guest account with the name Guest, and removed the password.

How do I display this "Guest" name by default, instead of my name during the login? (Already made the greeter-hide-users=false in the lightdm.conf)

Just wanted the other people at home to be able to simply press login to begin, instead of choosing the user and select Guest and then login. By default, it is showing my name for login.

Thank you for any information.
Last edited by M22 on 2024-03-13 22:56, edited 2 times in total.

User avatar
fabien
Forum Helper
Forum Helper
Posts: 688
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 62 times
Been thanked: 161 times

Re: [O/S] How to display default user in Lightdm on login?

#2 Post by fabien »

There may be a simpler solution, but here is the solution I found and how I found it.

In /etc/lightdm/lightdm.conf I spotted the line

Code: Select all

# greeter-setup-script = Script to run when starting a greeter (runs as root)
This looked like something usable to reconfigure lightdm when it starts. So I first looked at what we had on hand. The Bash set command displays the variables that have been set.
So I made a script /etc/lightdm/custom-greeter-setup-script:

Code: Select all

#!/usr/bin/env bash

set >/tmp/custLightdm
and made it executable:

Code: Select all

#> chmod +x /etc/lightdm/custom-greeter-setup-script
and added this line to /etc/lightdm/lightdm.conf:

Code: Select all

greeter-setup-script=/etc/lightdm/custom-greeter-setup-script
and then restarted lightdm.
In /tmp/custLightdm I saw the line

Code: Select all

HOME=/var/lib/lightdm
In /var/lib/lightdm/ I found the file /var/lib/lightdm/.cache/lightdm-gtk-greeter/state which contains

Code: Select all

$> cat /var/lib/lightdm/.cache/lightdm-gtk-greeter/state 
[greeter]
last-user=myusername
last-session=lightdm-xsession
This is how lightdm saves the last user which is then used when opening a new session.

So I changed /etc/lightdm/custom-greeter-setup-script with:

Code: Select all

#!/usr/bin/env bash

sed -i 's/^last-user=.\+$/last-user=defaultusername/' /var/lib/lightdm/.cache/lightdm-gtk-greeter/state
This replaces any user name with the username you want to use as default. Just change defaultusername to this name, of course.

M22
Posts: 29
Joined: 2024-01-28 07:35
Been thanked: 2 times

Re: [O/S] How to display default user in Lightdm on login?

#3 Post by M22 »

Hi, @fabien. Very much thanks for your detailed reply. And not just reply but also how you have come to that. Nice!

User avatar
fabien
Forum Helper
Forum Helper
Posts: 688
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 62 times
Been thanked: 161 times

Re: [O/S] How to display default user in Lightdm on login?

#4 Post by fabien »

You're welcome!
Please mark your topic as [Solved] if you validate the solution.

Post Reply