How do I recover data from an encrypted Home directory

Here is how you recover data from an encrypted home: (sdx should be your SATA drive)

sudo mkdir /recovery
sudo mount /dev/sdx /recovery
sudo mount -o bind /dev /recovery/dev
sudo mount -o bind /dev/shm /recovery/dev/shm
sudo mount -o bind /dev/pts /recovery/dev/pts
sudo mount -o bind /sys /recovery/sys
sudo mount -o bind /proc /recovery/proc
sudo mv /recovery/etc/resolv.conf /recover/etc/resolv.conf.orig
sudo cp /etc/resolv.conf /recovery/etc/resolv.conf

sudo mkdir /data-recovery
sudo mkdir /recovery/data-recovery
sudo mount --rbind /data-recovery /recovery/data-recovery
sudo chroot /recovery
su - user

ecryptfs-mount-private
cd /home/username

sudo mount -o bind /home/username /data-recovery

Remember, don't close the terminal until you are done with the data if you bind it. Once you bind it you should be able to access the folder /data-recovery (from the LiveCD root) and pull all the data using a GUI. If the last bind does not work, you can remove the last bind and simply cp -avr everything from /home/username to the chroot /data-recovery and it show up in the liveCD /data-recovery.


Or you can use the ecryptfs-recover-private tool now included in Ubuntu 11.04:

Recover your Encrypted Private Directory

Tags:

Encryption