Have you ever mistakenly shut down or rebooted your operation-critical server while you were willing to halt your desktop computer through ssh before going to bed, or anything like this? If so, and if you are on Debian/Ubuntu, molly-guard is designed for you: this nifty bash script gets between you and the shutdown/reboot/halt tools, checking if you are connecting through ssh and if so asking for the hostname of the machine before proceeding.
Wondering how it looks? Here is the output of a little test:
ixce@timmy:~$ sudo shutdown -r
W: molly-guard: SSH session detected!
Please type in hostname of the machine to shutdown:
Good thing I asked; I won't shutdown timmy ...
Since it doesn’t correctly handle sudo yet (actually sudo is at fault here, since it drops SSH_CONNECTION environment variable when doing its stuff), you might want to add PRETEND_SSH around the beginning of /usr/sbin/shutdown as specified on Nico “nion” Golde’s blog.
You might also want to grab the molly-guard 0.3.2 etch package I backported from sid (all I changed is downgrade debhelper build-dep version and debhelper compatibility level in debian/compat since etch only has debhelper 5 and the sid package required debhelper 6 ; this shouldn’t break anything since the newer debhelper just seems to be needed to recognize a few fields in debian/control about where the package is maintained). Sources are also available, anyway.
Thanks hr for the tip
October 23rd, 2015 at 1:28 pm
Find more there:
[…] What host are you the use of? Can I am getting your associate link for your host? I desire my website loaded up as fast as yours lol[…]
October 30th, 2015 at 1:01 pm
[…] In case anyone else wonders how molly-guard works, here's an example: guillaume.segu.in/blog/home/118/… […]
May 12th, 2016 at 11:13 am
moving desktop wallpapers
I found a great…
May 24th, 2016 at 11:53 am
free wallpaper for desktop
I found a great…
May 24th, 2017 at 11:56 am
… [Trackback]
[…] Read More: guillaume.segu.in/blog/home/118/molly-guard-prevent-accidental-shutdownsreboots/ […]
July 1st, 2019 at 9:00 pm
reliable proxy
I found a great…
October 28th, 2019 at 4:21 pm
Liliana Drumgo
I found a great…
April 2nd, 2020 at 6:17 pm
Buy Proxy Server
I found a great…
April 21st, 2020 at 7:04 pm
Marcelo Gayoso
I found a great…
May 5th, 2020 at 10:29 pm
Andre Kotzen
I found a great…
May 6th, 2020 at 3:37 pm
Cesar Wallis
I found a great…
May 7th, 2020 at 7:30 pm
Best Proxies
I found a great…
June 3rd, 2020 at 8:04 pm
Enrique Clayborne
I found a great…
June 3rd, 2020 at 11:25 pm
Charline Ficklen
I found a great…
June 12th, 2020 at 4:36 pm
Mirian Server
page-description
August 10th, 2020 at 7:28 pm
Judson Morey
I found a great…