Ubuntu – Disabling shutdown command for all users, even root – consequences

rootshutdownsudo

I would like to disable the shutdown command for all users, even root, on an Ubuntu Server installation.

The reason I want to do this is to ensure that I don't get into the habit of shutting down the machine in this way, as I SSH into a lot of production machines at the same time as this one, and I don't want to accidentally shutdown one of the other machines by typing the command into the wrong window.

The server I want do disable shutdown on only runs inside VirtualBox on my Windows desktop, and I only use it for local testing so it is not a problem if I can't shut it down from the command line.

I have already mitigated the problem a bit by ensuring I have a different password on the VirtualBox image, but obviously if I am within the sudo 'window' on one of the production machines, I could still accidentally shut it down.

My questions are:

  1. How do I disable the shutdown command?
  2. If I do disable the shutdown command, are there any consequences that I should be made aware of? Most specifically, will it disable support for ACPI shutdown that is the equivalent of pressing the power button on a physical machine? Could it affect other generic applications?

For information, I just use this VirtualBox image for trying out shell scripts, running Tomcat and Java, and that kind of thing.

Best Answer

If you usually run the command as sudo shutdown, rather than sudo /sbin/shutdown, then you can just setup a global shell alias for "shutdown" to just echo a message to the terminal instead. The real executable will still be there for all other purposes.