<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>delx &#187; crypto</title>
	<atom:link href="http://delx.net.au/blog/tag/crypto/feed/" rel="self" type="application/rss+xml" />
	<link>http://delx.net.au/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 13 Apr 2012 14:05:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Encrypted file systems on Debian/Ubuntu Linux</title>
		<link>http://delx.net.au/blog/2009/08/encrypted-file-systems-on-debianubuntu-linux/</link>
		<comments>http://delx.net.au/blog/2009/08/encrypted-file-systems-on-debianubuntu-linux/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 15:06:57 +0000</pubDate>
		<dc:creator>delx</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[crypto]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://delx.net.au/blog/?p=179</guid>
		<description><![CDATA[Recently I set up an encrypted file system so I could do rsync backups to a secured location. What you end up with is a mountable file system that you can use to securely store data. Debian offers an easy way to set up encrypted file systems using the LUKS standard with the cryptsetup package. [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I set up an encrypted file system so I could do rsync backups to a secured location. What you end up with is a mountable file system that you can use to securely store data. Debian offers an easy way to set up encrypted file systems using the LUKS standard with the cryptsetup package. You&#8217;ll need to enter a decryption passphrase to mount the volume whenever the system boots.</p>
<p><span id="more-179"></span></p>
<h4>Package installation</h4>
<p>Install the required packages:</p>
<pre># aptitude install e2fsprogs cryptsetup</pre>
<h4>Partitioning</h4>
<p>Use your favourite partitioning tool, for example <tt>fdisk</tt> or <tt>cfdisk</tt> to set aside a whole partition with enough space to store your data.</p>
<h4>Erase</h4>
<p>This step is optional. For complete security you want the contents of the disk to be random before you start using it. Use the <tt>badblocks</tt> tool to do this.</p>
<pre>
# badblocks -c 10240 -s -w -t random -v /dev/sdX9
</pre>
<h4>Format</h4>
<p>The <tt>luksformat</tt> tool will format a partition to be used with LUKS (Linux Unified Key Setup) and then create a filesystem on it.</p>
<pre># luksformat -t ext3 /dev/sdX9</pre>
<h4>Mounting Manually</h4>
<p>First use cryptsetup to create a device file:</p>
<pre># cryptsetup luksOpen /dev/sdX9 cryptofoo</pre>
<p>You can now mount the device from /dev/mapper/cryptofoo:</p>
<pre># mount /dev/mapper/cryptofoo /mnt</pre>
<p>When you&#8217;re done, unmount and then remove the cryptofoo device.</p>
<pre># umount /mnt; cryptsetup luksClose cryptofoo</pre>
<h4>Mount on Boot</h4>
<p>Now all that remains is to add one line in each of crypttab and fstab</p>
<p>Add this line to <tt>/etc/crypttab</tt>:</p>
<pre>myname /dev/sdX9 none luks</pre>
<p>The <tt>crypttab</tt> file is examined by the system during boot. Each line maps a real encrypted device file (<tt>/dev/sdX9</tt>) to a virtual decrypted device file (<tt>/dev/mapper/myname</tt>). Once you&#8217;ve added done this run the following command to actually set up the mapping:</p>
<pre># /etc/init.d/cryptdisks restart</pre>
<p>Now you can set up that virtual device file to be mounted like any other. For example, the following command would mount your filesystem:</p>
<pre># mount /dev/mapper/myname /mnt</pre>
<p>Note that you should probably use partition UUIDs (<tt>UUID=XXXXX</tt>) in place of device file names (<tt>/dev/sdX9</tt>) in your <tt>crypttab</tt> for a more robust system. The easiest way to find these is by running:</p>
<pre># ls -l /dev/disks/by-uuid</pre>
<p>Add a line like this to <tt>/etc/fstab</tt></p>
<pre>/dev/mapper/myname /path/to/mountpoint ext3 defaults 0 2</pre>
]]></content:encoded>
			<wfw:commentRss>http://delx.net.au/blog/2009/08/encrypted-file-systems-on-debianubuntu-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

