Xfce Forum

Sub domains
 

You are not logged in.

#1 2019-01-05 17:52:55

ctac
Member
Registered: 2017-05-08
Posts: 35

reboot-multiple-sessions and switch user

Hi
On Debian GNU/Linux buster/sid with xfce and lightdm, I prevent gui user to shutdown or reboot when another user is logged in with polkit.
For this, like Debian use polkit 1.05, I use 3 pkla files like this one :

cat /etc/polkit-1/localauthority/50-local.d/Reject_All_Users_To_login1_reboot-multiple-sessions.pkla 
 
[Reject all users to use login1_reboot-multiple-sessions]
Identity=unix-user:*
Action=org.freedesktop.login1.reboot-multiple-sessions
ResultAny=no
ResultInactive=no
ResultActive=no

The others are the same with action :

  1. org.freedesktop.login1.power-off-multiple-sessions

  2. org.xfce.session.xfsm-shutdown-helper

It's OK when others users are logged in via TTY (Ctrl+Alt+F3) or ssh.

Now, I try to enabled the switch-user button in xfce menu.
I find a thread in this forum for that.

cat /usr/local/bin/gdmflexiserver

#!/bin/sh
dm-tool switch-to-greeter

It' Ok. I can now switch user from xfce with the button.
but ...
When I use this, I am not more able to shutdown or reboot.
It seems to me that login1 always find another user.

What I do ?

  1. Power on my computer.

  2. Login user1 with lightdm.

  3. Open xfce4-terminal.

  4. ps -e > first_ps

  5. Switch user

  6. Login user2 with lightdm.

  7. Logout user2

  8. Come back with lightdm.

  9. Login user1

  10. ps -e > second_ps.

I can't shutdown or reboot.

The diff in first_ps and second_ps

	PID	TTY		TIME		CMD
FIRST	49	?		00:00:01	kworker/0:2-events
FIRST	1120	pts/0		00:00:00	ps
SECOND	1190	?		00:00:00	kworker/u16:1-events_unbound
SECOND	1193	?		00:00:00	systemd
SECOND	1195	?		00:00:00	(sd-pam)
SECOND	1218	?		00:00:00	dbus-daemon
SECOND	1251	?		00:00:00	at-spi-bus-laun
SECOND	1256	?		00:00:00	dbus-daemon
SECOND	1262	?		00:00:00	xfconfd
SECOND	1268	?		00:00:00	gpg-agent
SECOND	1281	?		00:00:01	applet.py
SECOND	1286	?		00:00:00	agent
SECOND	1308	?		00:00:00	dconf-service
SECOND	1318	?		00:00:00	gvfsd
SECOND	1338	?		00:00:00	tumblerd
SECOND	1351	?		00:00:00	gvfs-udisks2-vo
SECOND	1355	?		00:00:00	gvfs-gphoto2-vo
SECOND	1359	?		00:00:00	gvfs-goa-volume
SECOND	1363	?		00:00:00	gvfs-mtp-volume
SECOND	1367	?		00:00:00	gvfs-afc-volume
SECOND	1375	?		00:00:00	gvfsd-trash
SECOND	1380	?		00:00:00	gvfsd-metadata
SECOND	1467	?		00:00:00	kworker/0:2-mm_percpu_wq
SECOND	1468	pts/0		00:00:00	ps

There is a lot of other lines but there are the same.

I read that the switch_user button is for gdm, so, I like to known if it's the same with it?
What can I do to tell to login1 that user2 is logout?
Thanks

Offline

#2 2019-01-05 19:12:36

ToZ
Moderator
From: Canada
Registered: 2011-06-02
Posts: 5,453

Re: reboot-multiple-sessions and switch user

So even after user2 logs out, there are still processes running for that user?

Does running the following command as a step 11:

loginctl list-sessions

...show 2 sessions?

If so, systemd has a method of force killing all user processes on user logout. To do so, edit /etc/systemd/logind.conf  and change:

#KillUserProcesses=no

...to read:

KillUserProcesses=yes

...and restart.

Offline

#3 2019-01-05 20:04:55

ctac
Member
Registered: 2017-05-08
Posts: 35

Re: reboot-multiple-sessions and switch user

Thank you very much.
It's ok now with :

KillUserProcesses=yes

Offline

Board footer

Powered by FluxBB