Cleaning-up a system for migration and destruction

system common

review/backup/migrate for every user incl. root

ls -lF /home/


crontab -l

and system-wide

cd /etc/
ls -altr

cat /etc/hosts
cat /etc/resolv.conf

ls -lF /etc/rc.local*
ls -lF /etc/rc.d/rc.local*
ls -lF /etc/rc.d/rc.inet1



find / -type f -size +1G

workstation specific

desktop documents pictures ...


public data

lftp -u auto,auto
lcd /data/backup/
mirror -R -e -c

sensible data

lftp -u auto,auto
lcd /data/
tar czf - TARGET/ | \
    openssl enc -aes-256-cbc -e -k "$secret" -pbkdf2 -out TARGET.tar.gz.aes \
    && echo done || echo FAILED

Wipe-out privkeys

apt install secure-delete
srm ~/.ssh/id_*

or if you deleted the file already forgot to shred it first, it will be difficult to locate the exact location of what is left of the file on the disk, your best option is to fill the unused space with zeros, on a mounted file-system

dd if=/dev/zero of=zero.raw status=progress
rm -f zero.raw

or on an un-mounted file-system

apt install zerofree
zerofree /dev/sdaX

Wipe-out disks

in case you are liberating that root-server from your farm, wipe-out your backups first

lftp -u auto,auto

then boot in rescue mode and

fdisk -l

mount /dev/sda1 /mnt/
apt update
apt install secure-delete
srm -rf /mnt/root/.ssh/
srm -rf /mnt/home/USERNAME/.ssh/
umount /mnt/

dd if=/dev/zero of=/dev/sda status=progress

or boot-up your box with rescue system and simply low-format everything

apt update
apt install htop

dd if=/dev/zero of=/dev/sda bs=1M status=progress
dd if=/dev/zero of=/dev/sdb bs=1M status=progress
dd if=/dev/zero of=/dev/sdc bs=1M status=progress

finally reboot in normal mode and get rid of the box.


How to securely delete data after rm

Clear unused space with zeros (ext3,ext4)