
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.sabayonlinux.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.sabayonlinux.org/index.php?title=HOWTO:_Encrypted_Fake_Partition&amp;feed=atom&amp;action=history</id>
		<title>HOWTO: Encrypted Fake Partition - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.sabayonlinux.org/index.php?title=HOWTO:_Encrypted_Fake_Partition&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://wiki.sabayonlinux.org/index.php?title=HOWTO:_Encrypted_Fake_Partition&amp;action=history"/>
		<updated>2013-05-24T22:43:39Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.4</generator>

	<entry>
		<id>http://wiki.sabayonlinux.org/index.php?title=HOWTO:_Encrypted_Fake_Partition&amp;diff=8716&amp;oldid=prev</id>
		<title>Azerthoth: New article</title>
		<link rel="alternate" type="text/html" href="http://wiki.sabayonlinux.org/index.php?title=HOWTO:_Encrypted_Fake_Partition&amp;diff=8716&amp;oldid=prev"/>
				<updated>2010-07-18T21:26:36Z</updated>
		
		<summary type="html">&lt;p&gt;New article&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Encrypted Fake Partition=&lt;br /&gt;
The goal of this how-to is to create a container on your hard drive that you can encrypt and mount as a new drive. This equates roughly to making a fake partition inside an existing one. It's a great and sneaky way to protect your sensitive data without having to encrypt your whole drive or repartition to make a dedicated storage partition. The size of the article may seem daunting. Don't worry, it's as big as it is because I took the time to explain a few things along the way. For the most part its a cookie cutter procedure.&lt;br /&gt;
&lt;br /&gt;
This whole operation will be done as root, so you might as well do that now.&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;$ su &lt;br /&gt;
Password: &lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
==Step One: Make the container==&lt;br /&gt;
&lt;br /&gt;
For this we will use dd to create a one gig blank file, or in this case what we will be using for our container.&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;&lt;br /&gt;
# dd if=/dev/urandom of=/path/to/file bs=1024k count=1024&lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
This makes dd read (if=) from a random number generator, take that and output it (of=) to a file that you define the name and location of in 1024 kilobyte chunks. The count=1024 make it write 1024 blocks of 1024k, in other words 1 gigabyte. This can take a minute or two, maybe long enough to go grab a cup of coffee.&lt;br /&gt;
&lt;br /&gt;
==Step Two: Mount the file as a loopback device==&lt;br /&gt;
&lt;br /&gt;
Next up is to make the computer think that the file is actually a device. This is a simple one liner.&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;&lt;br /&gt;
# losetup /dev/loop1 /path/to/file&lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
Now the computer see's the file you made pretty much just as it see's your hard drives, if with a different name.&lt;br /&gt;
&lt;br /&gt;
==Step Three: Encrypt the new device==&lt;br /&gt;
&lt;br /&gt;
Now we will encrypt the device. During the process it will ask you to set a password. Make sure it is something you can remember, if you forget or loose the password then the container is a brick. You cant hack or crack into it, which is why we are encrypting it anyways.&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;&lt;br /&gt;
# cryptsetup -y -s 256 luksFormat /dev/loop1&lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Step Four: Create a file system==&lt;br /&gt;
We have to give the system access to the device now and tell it that it is block device.&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;&lt;br /&gt;
# cryptsetup luksOpen /dev/loop1 somename&lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
Finally we are going to make a file system for the container. Without that we cant put things in there. For the example I will be using ext3, you can use whatever you like.&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;&lt;br /&gt;
# mkfs.ext3 /dev/mapper/somename&lt;br /&gt;
(somename is the one you used above)&lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Step Five: Make a mountpoint==&lt;br /&gt;
This will be used later, but it's simple and easy to make a dedicated mount point for it now. You can name it whatever you like, and out of habit I make all my mountpoints in /mnt you can make it where ever you like.&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;&lt;br /&gt;
# mkdir /mnt/container &lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Step Six: Cleaning up==&lt;br /&gt;
&lt;br /&gt;
Everything is done, you have an encrypted container. Lets shut everything down. In the next section I will show you how to bring it up for normal use.&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;&lt;br /&gt;
# cryptsetup luksClose somename&lt;br /&gt;
(somename is the one you used above)&lt;br /&gt;
# losetup -d /dev/loop1&lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
Now your system is back in the condition it was before we started, with the exception that we have our fake partition (or container) all ready to mount up and use.&lt;br /&gt;
&lt;br /&gt;
=Using The Container=&lt;br /&gt;
&lt;br /&gt;
This section can be easily scripted, I'll leave that up to you. For this we will be doing it manually step by step.&lt;br /&gt;
&lt;br /&gt;
==Step One: Mounting it all up==&lt;br /&gt;
You have seen most of this already. But this time we will just be setting it up for use.&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;&lt;br /&gt;
# losetup /dev/loop1 /path/to/file&lt;br /&gt;
# cryptsetup luksOpen /dev/loop1 somename&lt;br /&gt;
# mount /dev/mapper/somename /mnt/container&lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Where you see `somename` you can make that whatever you want. However it has to be the same name in both commands.&lt;br /&gt;
&lt;br /&gt;
==Some notes on use==&lt;br /&gt;
&lt;br /&gt;
At this point the device is ready to use, but right now only root has access to it. Since the device is encrypted, takes a password that only you will use to unlock it, and has to be manually mounted, I just give it full read/write access to make life easier. This can be done with one simple command.&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;&lt;br /&gt;
# chmod 777 /mnt/container&lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
That command only has to issued once, ever. You wont have to do it again. You can now access it as a normal user. If you like you can symlink it where ever you want to for ease of use the the `ln -s` command. Example as normal user:&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;&lt;br /&gt;
$ ln -s /mnt/container ~/&lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
This will create an easy to use link in the users home directory. You can leave the link there or remove it as you like. I personally don't bother with this step.&lt;br /&gt;
&lt;br /&gt;
==Step two: Unmounting, Closing, Locking==&lt;br /&gt;
So your all done, and you want to close everything up so no one can get at what you have stored. Simple enough, remember unmounting requires you to be root.&lt;br /&gt;
{{Console|&amp;lt;pre class=&amp;quot;clear&amp;quot;&amp;gt;&lt;br /&gt;
# umount /mnt/container&lt;br /&gt;
# cryptsetup luksClose somename&lt;br /&gt;
# losetup -d /dev/loop1&lt;br /&gt;
&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=Conclusion=&lt;br /&gt;
&lt;br /&gt;
All in all it's not too difficult a task. I hope you learned something and I hope you see that securing your data, even on an unencrypted machine is not all that difficult.&lt;br /&gt;
&lt;br /&gt;
Have Fun&lt;br /&gt;
~Az&lt;/div&gt;</summary>
		<author><name>Azerthoth</name></author>	</entry>

	</feed>