Making files unrecoverable
There are a several ways to avoid a deleted file from being restored (at least using standard tools).
shred is a tool that overwrites a file repeatedly with random data and, optionally, deletes the file.
- To delete the file after overwriting it, add the
- You can use
shredwith devices like
/dev/sdb(do not use
-uin such cases). You may want to use
-zto overwrite with zeros. Remember to recreate the filesystem (if you wipe a partition) or the partition table (if you wipe an entire disk) after the process.
This method is useless if there are backups, snapshots, the disks are part of a RAID system or if the filesystem is journaled or compressed. In short,
shred assumes the file system and hardware overwrite data in place. If it’s not the case, files will be recoverable.
As I showed you in Examples of the dd command usage, you can use
dd to wipe a partition or disk. Remember that you will need to recreate the filesystem or the partition table after the process.
dd if=/dev/zero of=<partition or device path>
<partition or device path>: block partition or device name, like
- You can add
bs=<bytes>to specify how many bytes read and write at a time, and
count=<number>to copy only a number of blocks (of the size specified in
shred, if there are backups in other partitions or disks or if the disk is part of a RAID system, files could be restored.
chattr allows to set attributes on files (like
chmod). One of its available parameters is
s. When a user remove a file, its blocks are overwritten with zeros.
# Use + or - to enable or disable this attribute chattr +s file
This feature will not work on ext2/3/4 filesystems with modern Linux kernels.
In Debian/Ubuntu systems, you can use
dpkg-reconfigureto reconfigure an installed package using intuitive dialogs. I will show you how to use this command to change some system settings.
If you have a scanned PDF and you want to be able to search and copy text from it, in this tutorial I will show you how to do it.
If you want to do X11 forwarding from your container to your host, you can type these simple commands.
If you don’t have a Graphical User Interface (GUI) on your Linux device, or you need a simple text-based web browser, I will show you a couple of great programs.
A comprehensive list of Linux-related websites sorted by categories.