Disabling shutdown command for all users, even root - consequences?
A much better approach to this problem is to install the molly-guard program on the boxes you don't want to shutdown, rather than trying to train yourself to never run shutdown.
molly-guard attempts to prevent you from accidentally shutting down or rebooting machines. It does this by injecting a couple of checks before the existing commands: halt, reboot, shutdown, and poweroff.
The typical configuration is that it asks you to type the hostname of the machine to confirm you are really on the right one.
It is possible to add new scripts to /etc/molly-guard/run.d
(as documented on the manpage, script files must follow naming expected by run-parts
.
If you really want to disable shutdown
(and this is such a bizarre idea), just do
chmod 0 /sbin/shutdown
then if you need to use it, chmod it back to 0755.
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.