* Paul Eggert <egg...@cs.ucla.edu> [250219 21:47]: > On 2/19/25 09:41, Arsen Arsenović wrote: > > they (gdm) are a user and they have a session. > > Adding additional filtration can only confuse admins who compare 'who' > > and other tools. > > It is exactly that confusion that I'm trying to prevent. > > The man page for "who" says "who - show who is logged on", but gdm is not > logged on. > > The POSIX spec for "who" says that "who" optionally reports the login time, > but there is no login time here because nobody has logged in. The POSIX spec > also says that "who -l" should list only lines where the system is waiting > for someone to login - which is what's happening with the gdm display - and > yet who with libsystemd doesn't do that. > > It's a stretch to say that gdm is a "user" in the sense that most people > understand "who". By default, "who" is supposed to list users who have > logged in, not random UIDs like daemon or systemd-resolve or gdm that cannot > log in.
I don't really know my way around the sd-logind API, but it looks like filtering on the session class (returned by sd_session_get_class) might be fruitful. pam_systemd(8) has an explanation on the classes. I would probably filter out these: greeter, lock-screen, manager, manager-early. Looking at the "pam_issue" implementation, it only counts sessions with a class matching user* as logged in users. Chris