Guard that Molly!

written on Thursday, December 23, 2010

Having a Molly Guard to protect your servers from accidental shutdows is woth a lot, once you've tried to do it to the wrong machine:

  1. sudo reboot
  2. Discovering you're on a remote production server, instead of somewhere else...
  3. SHIT! SHIT! SHIT! - wrong machine! OMFG!

Enter molly-guard

First, install molly guard:

sudo apt-get install molly-guard.

It basically aliases reboot, halt, shutdown and friends to a small script that first checks if you're on a remote connection. So next time your'e about to do something really stupid on a remote machine, molly-guard kicks in:

sudo reboot
W: molly-guard: SSH session detected!
Please type in hostname of the machine to reboot:

This entry was tagged Debian, Ubuntu and server