Tuesday, November 9, 2010

Accessing encrypted home folder using Ubuntu live cd

So my laptop crashed during the upgrade to 10.10.
There was no easy way to recover the system,
so time to back up data. but I did not realize until,
I encrypted the home my home folder. so how to
recover the data for back up.

below is the solution provided by "jrider" from Ubuntu forums.

//Mount the disk partition containing
//the Encrypted Home Directory:
ubuntu@ubuntu$ sudo mount /dev/sda1 /mnt
Establish a proper chroot environment:
ubuntu@ubuntu$ sudo mount -o bind /dev /mnt/dev
ubuntu@ubuntu$ sudo mount -o bind /dev/shm /mnt/dev/shm
ubuntu@ubuntu$ sudo mount -o bind /proc /mnt/proc
ubuntu@ubuntu$ sudo mount -o bind /sys /mnt/sys
ubuntu@ubuntu$ sudo chroot /mnt

//Become the user whose data needs recovery (i.e. “foo”)
//and manually add the necessary mount passphrase to the
//kernel session keyring:

root@ubuntu$ su – foo
foo@ubuntu$ ecryptfs-add-passphrase --fnek
Passphrase:

Mount the encrypted directory and then access the data:
foo@ubuntu$ ecryptfs-mount-private
foo@ubuntu$ cd $HOME
foo@ubuntu$ ls -alF

No comments: