My Ubuntu-encrypted home directory was lost when I changed my user password.

This was because I did it from the command line as root. So my user password is no longer linked to my encrypted user data. How do I reunite them?

  • Usually you can boot to recovery mode and again as root change the password back to the old one. In the future change your password with the graphical tools. See bodhizazen.net/Tutorials/Ecryptfs#Password – Panther Sep 22 '14 at 15:20
  • Dear bodhi.zazen, your excellent website was crucial in helping me diagnose the problem. And I did indeed use Dustin Kirkland's recovery tool to recover the data (blog.dustinkirkland.com/2011/04/…). But resolving the problem is another matter. That means making the old /home/user1 work in a new /home/user2. It is apparently not as they say, a simple matter of copying the directory over. – markling Sep 23 '14 at 8:13
  • No, encryption adds a layer of complexity, backups are more complex as well. – Panther Sep 23 '14 at 11:10
  • Also see askubuntu.com/questions/562046/… – guntbert Dec 8 '16 at 18:46

If you did not change the password because you forgot it, you can change it back, make a backup without encryption, delete everything, change password again and restore everything. That's what I can guess while not knowing how the encryption works. Hopefully it will encrypt on import, if you want to feel safe, backup and just copy it somewhere and try to copy back first.

  • That will partially work. See the link I gave for additional information. – Panther Sep 22 '14 at 17:30

I attempted two solutions to rescue this home data for my user1 (let's call it that).

The restult is I have my data but have lost system integrity.

i.) Changed user1 password back to what it was originally

ii.) Set up another encrypted user account (user2), used Dustin Kirkland's tool to recover the data from user1, copied it into user2 home (relying on the oft-cited linux boast that all you have to do to backup is copy your /home directory).

The result was mayhem.

It was on the face of it not mayhem. It looked on the face of it like this:

i) Result: user1 account reopened and data accessible by turning password back

ii) Result: user2 account created, and turned into copy of user1 by copying /home/user1 recovery dir into it after being extracted with Kirkland's tool.

The mayhem was that my system has now confused passwords between the two accounts.

i.i.) user1 login requires old password now reinstated (as expected)

i.ii.) login as user1 root on command line requires root password (as expected - root password was changed when the other user passwords were changed in the operation that caused this bug)

i.iii.) user1 GUI authentication (e.g. when mounting disk) asks for user2 password. This is not expected and not desirable. It would normally ask for root password in this situation.

ii.) user2 account opens with expected user2 password, and begins to display last saved state of user1, but crashes instantly. Complete lockup.

Peter Nerlich's convoluted solution looking quite attractive now.

(N.B. Concrete advice on ii. seems scarce. While it seemed sensible to reinstate home/user1 into the /home directory of another user with the same name, it seemed inadvisable to create two user accounts with the same name on the same machine. And since Kirkland's tool performed its rescue by extracting /home/user1 into a temp directory, it was counter-intuitive to try and put this back in /home/user1. So this was like a conjunction of catch-22's, with snakes and spaghetti all mixed up together. Horrible. Really horrible).

Not the answer you're looking for? Browse other questions tagged or ask your own question.