In the past, I installed Ubuntu 12.04 with /dev/sda4 mounted as /home. I encrypted my home directory.

Today, I erased all the partitions except /dev/sda4 and I installed Xubuntu 14.04 on a new partition (/dev/sda3). I did not mount /dev/sda4.

Then I used usermod to change my home directory from /home/jordan to /home-old/jordan. Then I mounted /dev/sda4 as /home.

Now I want to change my current home directory from /home-old/jordan to /home/jordan, keeping the original (encrypted) contents of /home/jordan.

How can I do this? (I know both the login password and the ecryptfs passphrase used to encrypt the old home directory.)


A good starting point is the mount.ecryptfs_private(1) man page and the ecryptfs-mount-private(1) interactive command. Beware, I have never used this; on my ubuntu 14.04 I opted for encrypted home dirs and I now have a per-user directory /home/.ecryptfs/user/.ecryptfs/ with encryption info in several files, and /home/.ecryptfs/user/.Private/ with the encrypted data.

When I login it seems the pam module pam_ecryptfs(8) uses my login password to unwrap the passphrase, add it to my kernel keyring, and do the mount. I end up with /home/user/. Private mounted on /home/user.

/usr/share/doc/ecryptfs-utils/README.gz has more info.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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