Skip to content

Start a RAM Linux system and free your system disk without physical access to your server.

License

Notifications You must be signed in to change notification settings

Jamesits/menhera.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 

Repository files navigation

menhera.sh

Start a RAM Linux system (Debian for now) without requiring physical access to your server.

With menhera.sh you can:

  • format your system disk or create RAID
  • install a new distro
  • do important maintenance or backup with nobody writing to your root filesystem
  • ...

with only SSH!

"menhera" is short for "mental healer".

WARNING

I am not responsible for bricked devices, dead HDDs and SSDs, unreplied tickets, thermonuclear war, or you getting fired because your device is hacked to mine bitcoin. Please do some research if you have any concerns about this script before using it! YOU are choosing to run this script, and if you point the finger at me for messing up your device, I will laugh at you.

Dependencies

  • Linux kernel: overlayfs and tmpfs support
  • systemd
  • bash
  • squashfs-tools
  • curl or wget
  • ~400MiB RAM in theory

Usage

  1. Save your work
  2. Backup all your important files
  3. Shutdown as many services and programs you can on the victim
  4. If you use SSH to connect to the server, make sure you can log in directly as root using SSH with a password (You need to set a password for root!)
  5. run the script, and follow the instructions

menhera.sh will try to download a new rootfs into the memory, replace the old rootfs and kill all processes accessing the old rootfs. The old rootfs will be mounted to /mnt/oldroot. An simplified example filesystem structure after running menhera.sh on my test VPS:

root@localhost:~# findmnt
TARGET                                SOURCE     FSTYPE     OPTIONS
/                                     overlay    overlay    rw,relatime,lowerdir=/tmp/menhera/newrootro,upperdir=/tmp/menhera/newrootrw,workdir=/tmp/menhera/overlayfs_workdir
├─/sys                                sysfs      sysfs      rw,nosuid,nodev,noexec,relatime
├─/proc                               proc       proc       rw,nosuid,nodev,noexec,relatime
├─/dev                                udev       devtmpfs   rw,nosuid,relatime,size=1014856k,nr_inodes=253714,mode=755
├─/run                                tmpfs      tmpfs      rw,nosuid,noexec,relatime,size=205236k,mode=755
├─/mnt/oldroot                        /dev/md0p1 ext4       rw,relatime,discard,data=ordered
└─/tmp                                tmpfs      tmpfs      rw,relatime
  └─/tmp/menhera                      tmpfs      tmpfs      rw,relatime
    └─/tmp/menhera/newrootro          /dev/loop0 squashfs   ro,relatime

Thanks

About

Start a RAM Linux system and free your system disk without physical access to your server.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages