Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nepsilon/4dd249780ce23ef3c8386c72200f050c to your computer and use it in GitHub Desktop.
Save nepsilon/4dd249780ce23ef3c8386c72200f050c to your computer and use it in GitHub Desktop.
How to prevent accidental shutdowns and reboots? — First published in fullweb.io issue #99

How to prevent accidental shutdowns and reboots?

By Fabien Loudet, Senior SysOps at Rosetta Stone

Debian based distributions offers a package named molly-guard. It is a utility preventing yourself to accidentally reboot or shutdown the wrong system.

Once installed, it will override the existing shutdown, reboot, halt and poweroff commands by asking you to type the hostname of the machine, in order to confirm that it is really what you intended to do.

$ sudo reboot
W: molly-guard: SSH session detected!
Please type in hostname of the machine to reboot: ^C
Good thing I asked; I won't reboot tianhe-2 ...
W: aborting reboot due to 30-query-hostname exiting with code 1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment