[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Logging off an X session closes all ssh -X connections started previously from outside X

On Thu, 4 May 2023 at 19:07, zithro <slack@rabbit.lu> wrote:

> this is a rather strange problem, I hope the title is explicit enough.

Subject: Logging off an X session closes all ssh -X connections
started previously from outside X

> Here is what happens chronologically :
> 1. I start various SSH connections to a host, some normal, some with X
> forwarding, like that: "ssh user@host" and "ssh -X -n user@host GUI_APP"
> (like firejail firefox, firejail thunderbird, etc). There's no user
> connected under X yet, only the greeter is displayed.
> 2. using VNC or rdesktop, I then log on to X on the machine, do some
> stuff, then hit "log off" from the desktop menu.
> Immediately, ALL the previous SSH connections started in step 1 get
> closed, hence all the shells and the GUI apps (firefox, etc) !
> Everything is done using the same local and remote users (same UID but
> different names). sshd is the parent process of all my remote SSH sessions.
> I don't get how apps and shells NOT started via the X session, moreover
> previously to its creation, are closed when the X session closes, what's
> happening here ?!

> As the outcome is the same with VNC and rdesktop, I guess the problem is
> lying in the OS. Could it be related to logind ? Or an SSH(d) setting ?

That sounds like what is documented here, with the solution at the end:

$ apt show dbus-user-session
Package: dbus-user-session
Version: 1.12.24-0+deb11u1
[... some output snipped for brevity ...]
Description: simple interprocess messaging system (systemd --user integration)
 D-Bus is a message bus, used for sending messages between applications.
 Conceptually, it fits somewhere in between raw sockets and CORBA in
 terms of complexity.
 On systemd systems, this package opts in to the session model in which
 a user's session starts the first time they log in, and does not end
 until all their login sessions have ended. This model merges all
 parallel non-graphical login sessions (text mode, ssh, cron, etc.), and up
 to one graphical session, into a single "user-session" or "super-session"
 within which all background D-Bus services are shared.
 Multiple graphical sessions per user are not currently supported in this
 mode; as a result, it is particularly suitable for gdm, which responds to
 requests to open a parallel graphical session by switching to the existing
 graphical session and unlocking it.
 To retain dbus' traditional session semantics, in which login sessions
 are artificially isolated from each other, remove this package and install
 dbus-x11 instead.

Reply to: