[SOLVED] Shutdown while other user logged on

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Viking-bg
Level 1
Level 1
Posts: 6
Joined: Thu Mar 13, 2014 6:13 am

[SOLVED] Shutdown while other user logged on

Post by Viking-bg »

Hi,

I have been using Mint since 17.1 as my main pc. In that version the OS had a "safety feature" that prevented the pc from shutting down while another user was still logged on. I have upgraded to Mint Cinnamon 19.1, but this feature is now missing (I tested it on 18.3, and there it is missing also).

Here is the problem in more detail. My wife logs into her 19.1 Cinnamon profile and does some work. She forgets to save her document. She leaves the pc on to do something else. I get to the same pc, click on Cinnamon's "Log out button", and simply "switch user". I then work on my stuff. When I click on Cinnamon's "Quit" button and selects the "Shut Down" button, it shuts the computer down in Mint 19.1, causing my wife's work to be lost.

In Cinnamon 17.3 it worked correctly. If I tried to shut down, it would take me back to the login page, and thereby indicate someone else is still logged on. Only after all accounts have been logged out, will the pc shut down.

What should I change in Cinnamon 19.1 to re-enable this feature?

I suspect it might have something to do with the fact that I set the pc to login to my wife's profile without asking her password (no-login), but I disabled that option, and it still shuts down regardless. Any suggestions welcome...

Thanks for the help.

(P.S. I tried to post in the other forums, but it did not have the New Topic button enabled. Probably since I am a newbie...)
Last edited by Viking-bg on Mon May 27, 2019 11:22 am, edited 1 time in total.
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Shutdown while other user logged on

Post by smurphos »

Mmm, I'm sure I recall this working to prevent shutdown or reboot with other users logged in on 18.x or maybe 19.x at some point but you are right it doesn't work now (in Mint 19.1 Cinnamon edition in any case)

I've been trying a few tweaks to the relevant polkit rules so see if I could get it up and running - no dice.

So likely a bug, but where I'm not sure - could be systemd, polkit, kernel, lightdm, cinnamon..... don't know.... :roll:
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
Viking-bg
Level 1
Level 1
Posts: 6
Joined: Thu Mar 13, 2014 6:13 am

Re: Shutdown while other user logged on

Post by Viking-bg »

Hi,

Thanks for the reply. Will keep on looking for a solution...
deepakdeshp
Level 20
Level 20
Posts: 12337
Joined: Sun Aug 09, 2015 10:00 am

Re: Shutdown while other user logged on

Post by deepakdeshp »

Viking-bg wrote: Sat May 25, 2019 5:24 am Hi,

Thanks for the reply. Will keep on looking for a solution...
If you find it, please share here.
If I have helped you solve a problem, please add [SOLVED] to your first post title, it helps other users looking for help.
Regards,
Deepak

Mint 21.1 Cinnamon 64 bit with AMD A6 / 8GB
Mint 21.1 Cinnamon AMD Ryzen3500U/8gb
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Shutdown while other user logged on

Post by smurphos »

I've managed to get this pretty much working on Mint 19.1 Cinnamon.

Step 1 - Fix user's never fully logging out. If you don't use this you can end up in a scenario on a multi-user machine that formerly logged in users are still seen by systemd as logged in and can inhibit shutdown/restart even when there is only one actually logged in user as the time.

Code: Select all

xed admin:///etc/systemd/logind.conf
Add the line KillUserProcesses=yes save and exit the editor.

Step 2 - Add rules to require logged in users to authenticate to shutdown or restart if there are multiple users logged in.

Code: Select all

sudo touch /etc/polkit-1/localauthority/50-local.d/multi-user-inhibit-shutdown-restart.pkla

Code: Select all

xed admin:///etc/polkit-1/localauthority/50-local.d/multi-user-inhibit-shutdown-restart.pkla
Copy and paste this into the text editor, save and close the text editor.

Code: Select all

[multi-user-inhibit-shutdown-restart]
Identity=unix-user:*
Action=org.freedesktop.login1.reboot-multiple-sessions;org.freedesktop.login1.power-off-multiple-sessions;
ResultActive=auth_admin
Step 3 - Reboot

Step 4 - Test

So for me with these tweaks applied I observe this behaviour. If two or more users are logged in, any attempt to reboot or shutdown from the GUI just logs that user out and returns to the login screen with the other user still logged in. From the login screen it is not possible to confirm shutdown or restart if there is one or more users logged in.

A sudoer user can still reboot or shutdown via the terminal using systemctl reboot -ior systemctl poweroff -i but will be asked to authenticate that command.

Otherwise if there is only one user logged in that user can shutdown or restart normally. If there are no logged in users, shutdown and restart can be accessed from the login screen normally.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
Viking-bg
Level 1
Level 1
Posts: 6
Joined: Thu Mar 13, 2014 6:13 am

Re: [SOLVED] Shutdown while other user logged on

Post by Viking-bg »

Hi,

Many thanks Smurphos! it works perfectly, and exactly as it should. Very much obliged! :D :D :D
User avatar
karlchen
Level 23
Level 23
Posts: 18212
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: [SOLVED] Shutdown while other user logged on

Post by karlchen »

<mod> m-pescador's reprise of this old [solved] thread can be found here: LM 20.3 Shutdown while other user logged on </mod>
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
Locked

Return to “Beginner Questions”