Molly Guard

Wed, 5 Dec. 2007     Thomas Bendler     ~ 2 min to read

I was just about to shut down a server running Ubuntu 7.10 when I discovered the following message:

root@hal:~# shutdown -h now
W: molly-guard: SSH session detected!
Please type in hostname of the machine to shutdown: hal

Broadcast message from thbe@hal (/dev/pts/0) at 20:30 ...

The system is going down for halt NOW!

What is molly-guard? A check inside the local repository gives the answer:

protects remote machines from accidental shutdowns/reboots
The package installs a shell script that  overrides the existing
shutdown/reboot/halt/poweroff commands. If any of the three commands are
called interactively over an SSH session, the shell script prompts you to
enter the name of the host you wish to shut down. This should adequately
prevent you from accidental shutdowns and reboots.

This shell script passes through the commands to the respective binaries in
/sbin and should thus not get in the way if called non-interactively, or

A nice explanation about the name molly-guard could be found in the wiktionary:


1. /mol'ee-gard/ A shield to prevent tripping over a computer's Big Red Switch
(BRS) (emergency shutdown or power switch) by clumsy or ignorant hands.

Usage notes

Originally used of the plexiglass covers improvised for the BRS on an IBM 4341
mainframe after a programmer's toddler daughter (named Molly) tripped it twice in
one day. Later generalized to covers over stop/reset switches on disk drives and
networking equipment.

It’s every time great fun with the kids.

Share on: