September 29, 2009

Regaining access to an encrypted /home directory after re-installation of Ubuntu Jaunty Jackalope - Part I

Following the disaster of upgrading to Ubuntu Karmic Koala Alpha 6 (see
Upgrading from Ubuntu 9.04 to Karmic Koala Alpha 6 failed ... - Part I, II and III
I decided to re-install 9.04 Jaunty Jackalope with the alternate CD to be able to regain access my encrypted files. (BAD IDEA - read ahead!)

I decided to do a clean install and in order not to disturb my original /home/UserA directory (/home is on a separate partition from /) I chose to use UserB as the pseudo root account.

Logging in using UserB I re-created UserA as a user using the GUI (menu: System -> Administration -> Users and Groups). As /home/UserA was already present, i had to use /home/UserA1 as the /home dir for this user.

Having created the UserA I went into a shell and did:

$ sudo chown -R UserA,UserA /home/UserA

as it incorrectly had the UID and GID of UserB (UID=1000,GID=1000).

Setting

Now /home/UserB is having his /home dir encrypted so at least encryption is up and running. But I still could not access the old encrypted /home/UserA dir neither from being logged in as UserA or UserB.

Looking closer at the home dir I realised that I had missed something. The /home/UserB/.ecryptfs is symlinked to /var/lib/ecryptfs/UserB. This is where the passphrases and signatures resides. And I just deleted those by re-installing. DOH!

Do not delete your partition that contains /var/lib!

I will be back soon with an alternative solution - I hope (otherwise my files are lost :-/)

No comments: