<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/molly-guard-a-lifesaver-on-a-ubuntu-server-ipspace-net-blog-5gffnnql0" -->

---
title: Molly-Guard: a Lifesaver on a Ubuntu Server «...
description: molly-guard is an Ubuntu package that prevents accidental reboots or shutdowns by intercepting reboot-related commands (poweroff, reboot, etc.), detecting...
canonical: https://daily.dev/posts/molly-guard-a-lifesaver-on-a-ubuntu-server-ipspace-net-blog-5gffnnql0
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Molly-Guard: a Lifesaver on a Ubuntu Server « ipSpace.net blog | daily.dev
og:description: molly-guard is an Ubuntu package that prevents accidental reboots or shutdowns by intercepting reboot-related commands (poweroff, reboot, etc.), detecting...
og:url: https://daily.dev/posts/molly-guard-a-lifesaver-on-a-ubuntu-server-ipspace-net-blog-5gffnnql0
og:image: https://api.daily.dev/og/posts/5GFFNnqL0.png
og:image:alt: Molly-Guard: a Lifesaver on a Ubuntu Server « ipSpace.net blog
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Molly-Guard: a Lifesaver on a Ubuntu Server « ipSpace.net blog

**[ipSpace.net Blog](https://daily.dev/sources/ipspace)** · 2 min read · 0 upvotes · 0 comments

## Summary

molly-guard is an Ubuntu package that prevents accidental reboots or shutdowns by intercepting reboot-related commands (poweroff, reboot, etc.), detecting active SSH sessions, and requiring the user to type the hostname of the machine before proceeding. It's a simple safeguard against the common mistake of running shutdown commands in the wrong terminal window. The package is easy to install on Ubuntu, though getting it working on RHEL/CentOS/Rocky requires extra effort — a community member has created an RPM version available on GitHub.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.ipspace.net/2025/07/molly-guard-ubuntu>

## Questions this post answers

### How do I prevent accidentally running sudo poweroff or reboot on the wrong server over SSH?

Install the molly-guard package on Ubuntu. It intercepts all reboot-related commands, detects whether you are in an SSH session, and prompts you to type the hostname of the machine before proceeding. If you type the wrong hostname or cancel, the shutdown is aborted with a message like 'Good thing I asked; I won't poweroff brick2'.

_Sysadmins managing multiple SSH sessions track tools like molly-guard on daily.dev before an accidental poweroff costs them._

## Similar posts on daily.dev

- [My Raspberry Pi now fixes itself when services die, and I haven't SSHed in weeks](https://daily.dev/posts/my-raspberry-pi-now-fixes-itself-when-services-die-and-i-haven-t-sshed-in-weeks-vadmi1qoi) · XDA Developers · 2 upvotes · 1 comments
- [Secure your Linux server in minutes: The baseline security checklist](https://daily.dev/posts/secure-your-linux-server-in-minutes-the-baseline-security-checklist-wn5ifltwt) · All Things Open · 0 upvotes · 0 comments
- [Orphaned VMs: Running VMs Uninterrupted While Host Kernel Is Offline For Reboots/Updates](https://daily.dev/posts/orphaned-vms-running-vms-uninterrupted-while-host-kernel-is-offline-for-reboots-updates-ke0j5nf5f) · Phoronix · 0 upvotes · 0 comments
- [remotely unlocking an encrypted hard disk](https://daily.dev/posts/remotely-unlocking-an-encrypted-hard-disk-zhqhpg2kp) · Lobsters · 0 upvotes · 0 comments
- [Dev Machine Guard Now Supports Linux](https://daily.dev/posts/dev-machine-guard-now-supports-linux-hr7atzii4) · StepSecurity · 0 upvotes · 0 comments

---

Tags: [#ubuntu](https://daily.dev/tags/ubuntu), [#ssh](https://daily.dev/tags/ssh), [#it](https://daily.dev/tags/it)

[View this post on daily.dev](https://daily.dev/posts/molly-guard-a-lifesaver-on-a-ubuntu-server-ipspace-net-blog-5gffnnql0)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Molly-Guard: a Lifesaver on a Ubuntu Server « ipSpace.net blog","url":"https://daily.dev/posts/molly-guard-a-lifesaver-on-a-ubuntu-server-ipspace-net-blog-5gffnnql0","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/molly-guard-a-lifesaver-on-a-ubuntu-server-ipspace-net-blog-5gffnnql0"},"datePublished":"2026-08-11T08:52:20.398Z","dateModified":"2026-08-11T08:58:56.070Z","description":"molly-guard is an Ubuntu package that prevents accidental reboots or shutdowns by intercepting reboot-related commands (poweroff, reboot, etc.), detecting...","image":"https://media.daily.dev/image/upload/s--qPvKM23u--/f_auto/v1722860399/public/Placeholder%2009","thumbnailUrl":"https://media.daily.dev/image/upload/s--qPvKM23u--/f_auto/v1722860399/public/Placeholder%2009","isAccessibleForFree":true,"articleSection":"ipSpace.net Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"ipSpace.net Blog","logo":"https://media.daily.dev/image/upload/s--xS7E82MT--/f_auto,q_auto/v1786438303/logos/ipspace?_a=BAMAMicg0","url":"https://daily.dev/sources/ipspace"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/molly-guard-a-lifesaver-on-a-ubuntu-server-ipspace-net-blog-5gffnnql0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ubuntu,ssh,it","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"ipSpace.net Blog","item":"https://daily.dev/sources/ipspace"},{"@type":"ListItem","position":3,"name":"Molly-Guard: a Lifesaver on a Ubuntu Server « ipSpace.net blog"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/molly-guard-a-lifesaver-on-a-ubuntu-server-ipspace-net-blog-5gffnnql0#faq","mainEntity":[{"@type":"Question","name":"How do I prevent accidentally running sudo poweroff or reboot on the wrong server over SSH?","acceptedAnswer":{"@type":"Answer","text":"Install the molly-guard package on Ubuntu. It intercepts all reboot-related commands, detects whether you are in an SSH session, and prompts you to type the hostname of the machine before proceeding. If you type the wrong hostname or cancel, the shutdown is aborted with a message like 'Good thing I asked; I won't poweroff brick2'. Sysadmins managing multiple SSH sessions track tools like molly-guard on daily.dev before an accidental poweroff costs them."}}]}
```

