[systemd-devel] Attaching virtual session (e.g. SSH) to seat

Andrei Borzenkov arvidjaar at gmail.com
Sat Oct 1 13:18:43 UTC 2022


On 01.10.2022 15:46, Nils Kattenbeck wrote:
> I am logging in on a PC using SSH and need to access some peripherals
> which are attached to seat0.
> loginctl shows that my session is not attached to any seat:
> 
> SESSION  UID USER      SEAT TTY
>      50 1000 septatrix      pts/0
> 
> The devices are added to the seat using udev rules
> and I explicitly want to avoid making the device world read-/writeable
> or adding it to a group.
> Reading through the man pages for systemd-logind, pam_systemd etc
> did not lead me anywhere helpful but only confirmed the fact
> that virtual sessions are not assigned any seat by default.
> However I was unable to find information on how it is determined
> if a session is "virtual" or whether it can be configured for pam/logind/udev...

pam_systemd first seat preference is XDG_SEAT environment variable so
you probably can somehow force it. But logind assumes seat0 has ttys and
session runs on specific ttyN so there could be unexpected issues with
session management (like activation/deactivation).

logind sets device permissions for the currently active session on
seat0. Normally there is just one such session - session that is
attached to foreground tty. If you manage to force (multiple) ssh
sessions to also belong to seat0 and multiple users are logged in
concurrently - which session should logind use to set permissions?

Also I am not sure logind can manage two multiple active sessions on the
same seat in the first place.


More information about the systemd-devel mailing list