Pages

Monday, October 4, 2010

Protect yourself from accidentally halting a server.

How to Protect yourself from accidentally halting a server.?

This is a good utility.

 In Short: use molly-guard (debian name)
While reading my 10 unix command line mistakes I've saw the wrong halting machine command.
It's nasty to halt some server instead of your local desktop.
I use molly-guard (on Debian servers - not avaliable in FreeBSD. dunno for other linuxes? any comments?) to protect myself from this kind of mistake.
It modifies the halt/shutdown script and asks you for the hostname of the server before shutdown if from ssh session.
  1. #>apt-get install molly-guard  

when installed if you try to shutdown or reboot:
  1. storm:/home/valqk# halt  
  2. W: molly-guard: SSH session detected!  
  3. Please type in hostname of the machine to reboot: ^C  
  4. Good thing I asked; I won't halt storm ...  
  5. W: aborting reboot due to 30-query-hostname exiting with code 1.  

phew!
molly-guard saved the world for me again! :-)
have a nice Friday evening!
cheers.

No comments:

Post a Comment