[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 09 May 2023 17:47, Vincent Lefevre wrote:

On 2023-05-04 21:07:17 +0200, zithro wrote:
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) !

I have a similar setup (I also use lightdm and systemd) and do the
same kind of thing, but I haven't noticed any such issue.

Damn, now I wanna know the differences between our setups ^^
Do you also have several DE installed (but not running concurrently) ?

BTW, you should also try GNU Screen to see if you have the same issue
with it (this could help debugging).

Do you mean trying "ssh u@h screen" ?
Never tried screen with GUI apps, does that work ?

More precisely, I have 2 machines: one at home and one at my lab.
At home, I have an almost persistent X session (I log out only
when I need), and from it I ssh to my machine at my lab and keep
this ssh session open also almost persistently.

At my lab, I log in when I arrive and always log out when I leave,
but this never affects the ssh session I have at home.

Note also that I normally also have a GNU Screen running on both
machines (but not always). In any case, the X login/logout via
lightdm at my lab never affects ssh and GNU Screen.

Dammit (although happy for you ^^).

User lingering is disabled on both machines. And no changes to
logind.conf at my lab (KillUserProcesses is "no" by default).

As said in other posts, dunno how user lingering is configured on my setups.
Tried to grep "linger" in /etc (on server), only found references to SElinux. logind.conf also has "#KillUserProcesses=no". Can it be declared elsewhere, ie. outside of /etc ?

I never use the -X ssh option, but I use X11 forwarding by default
(ForwardX11 yes), so I suppose that this is equivalent to -X.

No, AFAIK "ForwardX11 yes" is just to *allow* X11 forwarding, not to enable it on all ssh connections. Ie. running "ssh u@h GUI_APP" without "-X" does not provide the DISPLAY var, and so fails running GUI_APP with "Unable to init server: Could not connect: Connection refused".
Do you use "UsePAM yes" in sshd_config (server-side option only) ?

Thanks for your input, it confirms it's a problem in my config, not in the software.

Reply to: