I have a server where users are connecting using the RDP protocol, and accessing a Gnome desktop environment.

Even if they do not have permissions, I want to avoid any temptation/mistake/confusion given by the button "Shutdown". Just a "Log out" button provided by this extension

I could not find extensions that allows me to hide or disable the button.

https://askubuntu.com/a/93956/197910 as suggested below did not work to solve this.

Is there a way to achieve it?

  • Sorry, not very helpful, but I've just installed dconf-editor and couldn't find any option. I think gnome guys don't like much user customization. – guillermo chamorro Oct 9 '19 at 15:23
  • Could this help? askubuntu.com/questions/93542/… – vanadium Oct 9 '19 at 15:41
  • Manuel, please advise if either of the two solutions recently added meet your need. – K7AAY Dec 13 '19 at 18:20
  • Thanks for your edit and bounty @K7AAY, I could get an answer to my question – Manuel Dec 16 '19 at 10:36

Have created gnome-shell-extension https://github.com/PRATAP-KUMAR/Remove_Poweroff_Action_Button

Ubuntu 18.04.3 enter image description here

Ubuntu 19.10 enter image description here

  • 2
    Not sure why someone downvoted you. This seems to be exactly what OP is looking for - removal of the button, not permissions. – user31389 Dec 15 '19 at 13:52
  • @user31389 Hi, downvoted bcoz of previous answer.. askubuntu.com/posts/1195971/revisions but the person who downvoted did not comment, so we dont know him and cant reply him for the edits.. – PRATAP Dec 15 '19 at 13:55
  • 1
    This is exactly what I need. Thank you. Do you think you can make it available on the Gnome Extensions website? (I can also make it, but I think that you should take credit for it) – Manuel Dec 16 '19 at 10:26
  • 2
    @Manuel, Thanks for your guidance. I will do that.. rite now I am working on gsettings key for it, so that you can lock it.. no one can turn off this extension.. once I complete it.. I will do it Gnome Extensions.. – PRATAP Dec 16 '19 at 10:28
  • 1
    In my use case, I do not mind if the users disable the extension. They already know that they cannot (and should not) shutdown the system, this extension makes the interface more coherent and avoids misunderstanding. If they disable it, they just introduce noise to their own environment. But I understand what you are proposing. – Manuel Dec 16 '19 at 10:33

You can use this extension to hide the shutdown button.

hide shutdown button.png

This article describes how to disable shutdown and reboot:

Certain Linux distros such as Ubuntu, Linux Mint, Mandriva just to mention but a few, make it possible to reboot/halt/shutdown the system as a normal user, by default. This is not ideal setting especially on servers, it must be something to worry about especially for a system administrator.

Here are a summary of steps in article:

  • Edit /etc/sudoers to disable shutdown.
  • Use chmod o-x /sbin/shutdown and chmod o-x /sbin/reboot to deny permissions.
  • For systemd based systems (probably most today) use: chmod o-x /bin/systemctl which /sbin/shutdown and the rest have symbolic links to.

I don't know how to change the GUI to remove the "Shutdown" button but you can tell the users not to press it and if they do nothing will happen.

  • Even if this is a correct answer for not allowing users to reboot/shutdown the system, it is not an answer to my question. I want to remove the button from the pannel (and avoid any misunderstanding about what they can do) since they already cannot reboot the system. My goal is to be more coherent between what they can actually do, and what they see that they can do. – Manuel Dec 16 '19 at 10:28
  • @Manuel Fair enough, I've added a link to hide the shut down button with an extension. – WinEunuuchs2Unix Dec 16 '19 at 15:10
  • Thanks, I already checked that extension. It hides it from the bar, but the button is still present on the menu. – Manuel Dec 16 '19 at 15:20
  • It appears the one PRATAP wrote just for you will be the perfect fit! – WinEunuuchs2Unix Dec 16 '19 at 15:22

Adding the following lines into a file
will prevent shutdown from working. Other options will still work, and the server can still be shut down from the command line.

[Disable lightdm PowerMgmt]
Action= org.freedesktop.login1.power-off;org.freedesktop.login1.power-off-multiple-sessions

  • I've tried this on Ubuntu 18.04. It does not work and the system can still be rebooted from Gnome. After creating the file with the indicated content, I've rebooted the system to make sure the policy is updated. Do I need to make any other change? – Manuel Dec 11 '19 at 15:04
  • 1
    Well, GNOME evidently changed where that could be locked down. I will donate some points to see if we can't get a better answer. – K7AAY Dec 12 '19 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.