Remotely wipe a Linux based server

There may come a time when you need to remotely wipe a Linux based server. Maybe your server has been compromised, is no longer required in production or, for security reasons, you simply need to make sure that the server is fully erased and no longer recoverable.

Note: This process is specifically designed for headless servers, e.g. server which do not have a locally (or remotely – think KVM) screen, keyboard or mouse. There are other options available for locally accessible servers which a DBAN (or similar solution) can be ran on.

Step 1: SSH into the server then type:

# dd if=/dev/zero of=/dev/sdaX

To check the correct hard disk device to wipe use:

#df -h

The DD command will copy zeros over the whole disk, rendering any existing data useless.

Step 2: Wait approximately ~10 minutes (more for good (or worse?) measure) after which time run:

# echo 1 > /proc/sys/kernel/sysrq
# echo o > /proc/sysrq-trigger

These commands will initiate a full power off of the server.

For click here for more information on the sysrp command and here for information on the sysrp-trigger command.