Thorsten Kukuk wrote: > > The only problem with this mapping is for the ut_line row, which > > used to contain, for inbound ssh, the pty device name. It is not easy > > to find the pty name in this situation; at least, none of the systemd > > APIs and /run/systemd/** files that I looked at helped. > > You mean you don't see a TTY on ssh sessions?
Yes, I see a session uid=1001 user=other state=active active=Y remote=Y \ starttime=2023-08-01T15:19:25 seat=(null) leaderpid=40513 uiclass=user \ pamservice=sshd vt=-1 type=tty tty=(null) \ display=(null) desktop=(null) remotehost=::1 remoteuser=(null) "uitype=tty" and "tty=(null)" don't make much sense together. > openssh is really special: it does not need a TTY for all kind of ssh > sessions, and thus only opens a TTY if needed after creating the > logind session. Thus the logind session does not contain the TTY > informations. > systemd-logind v254 provides now an interface for this case, which > allows to set the TTY later. For openssh you need this patch: > > https://github.com/thkukuk/utmpx/blob/main/patches/openssh/logind-set-tty.patch That would make sense, yes. But I wonder: - Why is it possible to set the "type" of the session to "tty", without specifying a value for the "tty"? - While at it: Shouldn't OpenSSH also provide a value for the "remote_user" property? Bruno