Ubuntu – Recovering from a move of /home when it’s encrypted (ecryptfs)


I had a 20GB / partition at work that dual-booted with Windows and it quickly ran out of space. I usually do 20GB / and 160GB (or whatever the rest of the hard drive is) as /home, so I intended on recovering the space Windows was taking up and turning that into /home.

That went fine and I was able to mount the partition and rsync all my files over.

However, I forgot that the partition was encrypted, so now all my files are sitting in /home/.ecrypt and /home/$USER is empty.

How can I recover my files from /home/.ecrypt and move them to /home/$USER?

I followed this tutorial: https://help.ubuntu.com/community/Partitioning/Home/Moving

Best Answer

sudo ln -s /home/.ecryptfs/$USER/.Private /home/$USER/.Private
sudo ln -s /home/.ecryptfs/$USER/.ecryptfs /home/$USER/.ecryptfs
sudo chown $USER:$USER /home/$USER

Then log out and log back in. Note that these commands probably need to run as root (using sudo), as an unmounted /home/$USER might be readonly.

Related Question