1

I need to remove Suspend / Restart / Power Off… menu from Gnome Shell & GDM. enter image description here

I’ve been trying using Settings, Gnome Tweaks, Dconf Editor, but nothing found AFAIK.

Trying to enter the Polkit conf file gave the same results.

    polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.login1.power-off" ||
        action.id == "org.freedesktop.login1.reboot" ||
        action.id == "org.freedesktop.login1.hibernate" ||
        action.id == "org.freedesktop.login1.suspend") {
        return polkit.Result.NO;
    }
});

Any clue?

Thank you, Regards

4
  • same question asked elsewhere - and with some suggestions there: discourse.gnome.org/t/…
    – ingli
    Commented Aug 18, 2023 at 15:25
  • bugzilla.redhat.com/show_bug.cgi?id=843568 might be helpful
    – ingli
    Commented Aug 18, 2023 at 15:34
  • 1
    Removing them from the menu doesn't prevent them being accessed via another route (e.g. command lne) - you still need the polkit config.
    – symcbean
    Commented Sep 4, 2023 at 9:57
  • Hi, I agree, @symcbean, though that is not the point of the question in my reading of it.
    – ingli
    Commented Sep 8, 2023 at 16:21

1 Answer 1

0

1) For a per user Gnome Shell configuration, currently, the following well customizable extension seems to do the job well: https://extensions.gnome.org/extension/2917/bring-out-submenu-of-power-offlogout-button/

2) For the GDM level, following Florian Müllner's 2013 bug report response

 # cat > /etc/dconf/db/gdm.d/99-site-settings <<EOT
 >[org/gnome/login-screen]
 >disable-restart-buttons=true
 >EOT
 # dconf update
 # systemctl restart gdm.service

removes the Suspend / Restart part, but also disables Power Off.

In sum, create the file /etc/dconf/db/gdm.d/99-site-settings with the following content

 [org/gnome/login-screen]
 disable-restart-buttons=true

Then run dconf update and subsequently systemctl restart gdm.service. Note that the latter command will restart your Gnome session.

Then, following the proposal at the Gnome Discourse site, I like to suggestion to also consider what happens upon the command ctrl-alt-del. To implement this, I create the directory /etc/systemd/system.conf.d/ and in it the file 10-suppress-ctraltdel.conf, implementing How to override /etc/systemd/system.conf? answer, thus entering as content

 [Manager]
 CtrlAltDelBurstAction=none

Though, instead of none, other options are described here.

5
  • 1
    Many thanks @ingli for your answer. Do you have any idea if we can do the same but on a per user basis instead of system wide configuration?
    – Nexus1138
    Commented Aug 24, 2023 at 16:02
  • @Nexus1138, please check the edited post and accept if resolved; and vote up if anyhow helpful.
    – ingli
    Commented Sep 5, 2023 at 19:55
  • Thanks @ingli for point 1), this is a customization made as per user, but how would you apply this policy as system wide?
    – Nexus1138
    Commented Oct 2, 2023 at 9:20
  • Dear @Nexus1138, sorry, cannot help with that. I strongly suggest you ask a new question on that, and refer to this one. I believe the question you originally asked is sufficiently answered. If your question was not precisely worded, then please ask a new question, building on this one. I am sad you don't provide recognition of my work to help you.
    – ingli
    Commented Oct 5, 2023 at 12:53
  • I provided recognition to your work by thanks, but can't vote on this as the question is not answered. Thanks again for your time @ingli.
    – Nexus1138
    Commented Oct 6, 2023 at 7:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .