Ubuntu Remote System Wipe Headless
This will remotely wipe a debian based linux system such as Ubuntu server 18.04 bionic
Mostly ripped from here https://saveriomiroddi.github.io/Remotely-wiping-the-disks-of-a-headless-linux-server/
Assuming you are ssh'd into the remote box and have sudo...and on a reliable connection as if ssh session terminates after chrooting your stuffed.
(or perhaps you could start dropbear or something once in chroot on another port, not tried though.)
sudo -i systemctl stop nginx postfix dovecot bind9 raicale wpa_supplicant whoopsie smbd cron atd #stop most shit running, add other stuff to here depending on your system, careful not to nuke ssh! apt install debootstrap swapoff -a echo 3 > /proc/sys/vm/drop_caches #flush system cache mount -t tmpfs tmpfs /mnt debootstrap --variant=minbase --include=bsdmainutils,busybox bionic /mnt #install a Debian base system into /mnt tmpfs mount --bind /dev /mnt/dev # mirror /dev and /sys - allows block dev operations to work mount --bind /sys /mnt/sys # mount --bind /proc /mnt/proc # if /proc is not mirrored, after wiping, the system will crash chroot /mnt #do it dd if=/dev/zero of=/dev/sda status=progress conv=fdatasync bs=64k #wipe disk sda hexedit /dev/sda #satisfy yourself disk start is blank, right chevron skips to end of disk to check zerod out too. echo 1 > /proc/sys/kernel/sysrq echo o > /proc/sysrq-trigger #o not zero, o = shutdown
blog comments powered by Disqus