I have an Ubuntu 10.04 LTS Desktop PC with GNOME.

How can I fully disable the reboot/shutdown/suspend/hibernate functions in GNOME or even with root? So that the root gives out the "reboot" or "pm-suspend" command it doesn't do anything, and the machine goes on. How can I fully disable these basic "features"?

  • I dunno? As a kiosk? you just remove shutdown and pm-suspend from /sbin/ and /bin/
    – Amith KK
    Jan 7, 2012 at 13:04
  • Those files could be in cache, no? Removing them will permanently disallow the reboot/shutdown/suspend/hibernation function even in GNOME? Jan 7, 2012 at 13:13
  • Yes, it would probably do so @Lance Baynes
    – Amith KK
    Jan 7, 2012 at 13:16

4 Answers 4


User access to these actions are controlled by polkit. In particular, they correspond to the following actions:

  • org.freedesktop.consolekit.system.stop
  • org.freedesktop.consolekit.system.restart
  • org.freedesktop.upower.suspend
  • org.freedesktop.upower.hibernate

All of these actions are allowed by default for active local users (although consolekit further restricts the first two permissions to only work when there is a single user logged into the system).

If you want to disable these actions create a file /etc/polkit-1/50-local.d/disable-shutdown.pkla containing something like:

[Disable shutdown/whatever]

This should prevent those actions from completing. More information on these policy files can be found by running man pklocalauthority.

If you are trying to restrict root though, this will only be a minor inconvenience. By definition, root is an unrestricted account according to the traditional UNIX discretionary access control system. If you can't trust users you've given full root access to, then you've got bigger problems than them just shutting down the system.

Note that in later Ubuntu versions somebody decided to break compatibility. As answered in How to disable shutdown/reboot from lightdm in 14.04? the action seems to have changed to "org.freedesktop.login1.reboot" (and the-like).

For example in 14.04 adding the following lines as /etc/polkit-1/localauthority/50-local.d/restrict-login-powermgmt.pkla works:

[Disable lightdm PowerMgmt]

In addition note that this method block solely reboot/etc commands issued from GUI. To block reboot/etc commands from command line one may use molly-guard - as explained in Disabling shutdown command for all users, even root - consequences?

  • 3
    Stopped working here with Ubuntu 13.10 !!!
    – GabrieleV
    Jan 28, 2014 at 21:03
  • @GabrieleV Maybe version with login1 works in 13.10? I tested it in 14.04 - and hopefully nobody at Canonical breaks backward compatibility in polkit in every release for fun. Apr 16, 2016 at 15:04
  • As another data point, I just used this successfully on the new Ubuntu 18.04.1 LTS, to disallow shutdown and reboot (but allow hibernate and suspend). Note that I needed to use these 'login1' names; that I also disabled 'halt' and 'halt-multiple-sessions'; that I did that because I found those actions in /usr/share/polkit-1/actions/org.freedesktop.login1.policy; and finally, that in Ubuntu 18.04's gdm3 UI, the buttons in the confirmation dialog are not hidden, but they simply have no effect. Aug 7, 2018 at 19:13

Consider installing molly-guard.

sudo apt-get install molly-guard

This package will prevent unintended shutdown/reboot/suspend/hibernate by interactively prompting you to enter the hostname of the system.

However, it's trivial to configure molly-guard to completely disable shutdown/reboot/suspend/hibernate. Simply create an executable file at /etc/molly-guard/run.d/99-prevent-all that has this in it:

exit 1

Note it protects only against commands issued from command line, shutdown/reboot/suspend/hibernate issued from GUI is bypassing it. To block also GUI using reboot one may use polkit rules.

  • This is a good solution for a multi-user computer where the administrator needs to do work and prevent all the other users from shutdown for a while. Jan 4, 2013 at 5:51
  • 1
    Works from console, but even with molly-guard in place (and set to 'always ask') the shutdown proceeds without asking when initiating it from GNOME (3.4).
    – Jan
    Oct 13, 2014 at 16:22
  • Yeah, this is not working anymore... Since 13.10, maybe 13.04. Oct 17, 2014 at 3:42

WARNING! The commands listed here are dangerous to use. Do not use these except at your own risk!

chmod -x /usr/sbin/pm-suspend
chmod -x /sbin/reboot
chmod -x /sbin/shutdown
  • 5
    Can you substantiate your answer? I surely don't think he wanted to eliminate the possibilities of rebooting and shutting down.
    – viyyer
    Jan 10, 2012 at 3:43
  • How could one re-enable hibernation this way? Feb 5, 2012 at 19:49
  • use "chmod +x" not "chmod -x" Feb 6, 2012 at 17:58
  • 7
    Warning! Don't do this These commands are symlinked to /bin/systemctl and will remove the executable bit from it. This is a critical executable which also controls service SERVICE_NAME [stop|start|restart]. Your system will probably not boot anymore (if you can get it to shutdown at all).
    – Daniel F
    Feb 24, 2017 at 10:42
  • I ran these commands on an ubuntu VPS. Shutdown the VPS from the host, shutdown failed. It killed the SSH daemon. Force stopped and started, can SSH in just fine. After restart /bin/systemctl is set to read-write only-rw-r--r-- 1 root root
    – kryo
    Jul 13, 2017 at 21:22

Building on OP's answer, you can do

for file in $(/sbin/shutdown /sbin/reboot /usr/sbin/pm-suspend); do
    mv $file $file.bak && touch $file

This renames the symlinks and replaces them with blank files. This will prevent command-line shutdown, I don't know if the GUI commands call it or do their own thing so you might have to do the accepted answer as well.

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.