How To Encrypt existing home directory?

Paul S paulatgm at
Wed Mar 26 00:32:23 UTC 2008

Pedro Vanzella said the following on 03/25/2008 01:11 PM:
> I want to encrypt my existing home directory (I don't mind losing the 
> files, actually, I can make a backup) and the swap partition.
> Is there an easy how-to to help me do that? I looked around but all I 
> found was some very long guides on how to change the file system to an 
> ecrypted FS.
> By the way, my home partition is reiserFS.

I don't think it's possible to encrypt just a directory with the 
alternate installer cd.  You'd have to move your home directory to 
another partition and encrypt that partition.  If you have some free 
disk space, you might be able to use it for this partition.  I don't 
think it's possible to shrink your reiserfs installation to free up some 

If you have a free partition, you could

1. create a new partition from your free space
2. create luks encryption on the partition .. see "man cryptsetup"

	cryptsetup luksFormat /dev/<new partition no.>

3. mount it at boot up by adding it to /etc/crypttab and /etc/fstab.  It 
would prompt for the password.  After adding it, you have to add it into 
the initramfs with "sudo update-initramfs -v -u all".  See "man 
crypttab" , "man fstab" , and "man update-initramfs" for details.

4. reboot.. if successful, copy your existing /home directory to the new 
encrypted partition.

If this is too complex, then a reinstall with the alternate cd gives you 
all the tools in one place.


More information about the ubuntu-users mailing list