TIP: Debian/Ubuntu prevent accidental halts/reboots

If you’re connected to a server via SSH as root and accidentaly you type in “reboot” or “poweroff” this might really happend. To avoid this you could simply install a package:

apt-get install molly-guard

After this, if you type, for instance, “reboot” you will be prompted with your server’s hostname in order to really do it:

root@server:~# reboot
W: molly-guard: SSH session detected!
Please type in hostname of the machine to reboot:
Good thing I asked; I won't reboot server ...
W: aborting reboot due to 30-query-hostname exiting with code 1.