<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Shred on rooiratel</title><link>https://rooiratel.red/tags/shred/</link><description>Stephan Snyman's personal website</description><language>en-gb</language><generator>Hugo</generator><atom:link href="https://rooiratel.red/tags/shred/index.xml" rel="self" type="application/rss+xml"/><item><title>Secure disk wipe</title><link>https://rooiratel.red/posts/secure-disk-wipe/</link><pubDate>Wed, 31 Oct 2018 16:22:03 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/secure-disk-wipe/</guid><description>Secure disk wipe I recently got a new work laptop. Obviously I needed to transfer all my files from the old laptop to the new one. This is a pretty painless process. Normally I just format the disk on the old laptop when I’m done with it and hand it in.
However there are a lot of confidential files and data on my work laptop, and a simple format is not enough to get rid of them. It’s quite easy to recover files from a laptop that have not been deleted securely, and I didn’t want to be held liable if someone were to get hold of the files from my old laptop. I have no guarantees of what the person I hand my laptop to might do with it. It could get stolen, they might be bribed to hand over the hard drive to criminals etc.</description><content:encoded><![CDATA[<h1 id="secure-disk-wipe">Secure disk wipe</h1>
<p>I recently got a new work laptop. Obviously I needed to transfer all my files from the old laptop to the new one. This is a pretty painless process. Normally I just format the disk on the old laptop when I&rsquo;m done with it and hand it in.</p>
<p>However there are a lot of confidential files and data on my work laptop, and a simple format is not enough to get rid of them. It&rsquo;s quite easy to recover files from a laptop that have not been deleted securely, and I didn&rsquo;t want to be held liable if someone were to get hold of the files from my old laptop. I have no guarantees of what the person I hand my laptop to might do with it. It could get stolen, they might be bribed to hand over the hard drive to criminals etc.</p>
<p>So what should I do? Luckily Linux has a useful program called <code>shred</code> which will overwrite a file with garbage multiple times before it deletes it. This is a great solution, but it&rsquo;s rather tedious to run <code>shred</code> manually on multiple files on my hardrive.</p>
<p>My final solution was to use a combination of <code>find</code> and <code>shred</code> to recursively delete all the files and directories from a given directory. In this case, my <code>/home/</code> directory.</p>
<p>Here is the command:</p>
<p><code>find /home/rooiratel/ -type f -exec shred -u -v {} \;</code></p>
<p>Where <code>/home/rooiratel/</code> is the root directory of where you want to start deleting from.</p>
<p>Another useful task this does is to rename each file to a series of 0&rsquo;s before deleting it. I still need to figure out how to do this for directories.</p>
<p>Here is a screenshot of this command in action:</p>
<p><picture>
  
  

  

  
    

    <source srcset="/images/find_shred.avif" type="image/avif" >

    
    

    

  

  <figure>
    <img
      src="/images/find_shred.png"
      alt="screenshot"
      loading="lazy"
      decoding="async"
      width="485"
      height="981"
    />
	<figcaption></figcaption>
  </figure>
</picture>
</p>
<p>You can set the number of times you want <code>shred</code> to overwrite your files with the -n flag. The default is 3, but depending on how paranoid you are or how much time you have, you can set it as high as you like.</p>
<p>Once all of this is done you can format your hard drive as usual and hand in the device. Even if it gets stolen, or handed to a compromised employee, you won&rsquo;t have to worry that you have inadvertently leaked confidential company files/data.</p>
]]></content:encoded></item></channel></rss>