Skip to content

Instantly share code, notes, and snippets.

@msiebuhr
Created April 8, 2013 11:42
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 msiebuhr/5336221 to your computer and use it in GitHub Desktop.
Save msiebuhr/5336221 to your computer and use it in GitHub Desktop.

Guard that Molly!

slug

mullyguard

tags

Ubuntu, Debian, server

date

2010-12-23

category

System Administration

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:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment