3

I had my home folder encrypted during installation by checking "Encrypt my home folder".

Now, I'd like to reinstall the system, but reuse this home folder.
(I have 2 separate partitions for / and /home. The former is formatted during the reinstall, the later - unformatted and reused. Been using this method without encryption for years - no issues.)

It seems that Ubuntu does not take care of it automatically.

Removing encryption and encrypting everything once more sounds incredibly workaroundish. Depending on how you perform it, it could also leave out temporary unencrypted data ready to be recovered with recovery tools. Even when discarded after the migration process.


[Meta] Possible duplicate:

To all of folks that suggest that this is a duplicate of Why can I not deselect "encrypt my home folder"?:
Well, yes. That thread resolved my problem.
However, I did some research prior to posting this (which I always do) and the answer was nowhere to be found.
That's because I never saw the bloody form with encryption options disabled.
That's because I did some thinking on 'How will I migrate my encrypted $HOME?' before I actually got down to reinstalling and potentially carelessly loosing my data. 1
I sincerely hope there's more like-minded, precautious folk out there (if not, humanity is doomed).

IMO they will find this doubt reworded as "Reusing encrypted home …" helpful.
That's my opinion, however, it's up to you what you do with this thread.
After all, the reputation score is the ultimate measure of one's right.
Isn't it?


1: Yes, I do have a backup. Still, why resorting to backup when you can easily preserve your original data?

17
  • run dd, shreader or other freespace erasing program over the partition that had the unencrypted data after you have completed your migration and deleted the files. Overwriting the drive will prevent recovery
    – ravery
    Oct 25, 2017 at 14:27
  • The above notwithstanding, I must add that if you reinstall using the same username/password it usually works the same way as without encryption.
    – user692175
    Oct 25, 2017 at 14:28
  • @MichaelBay - I agree, but, "usually works" causes data loss with encryption.
    – Panther
    Oct 25, 2017 at 15:29
  • It usually does not cause data loss. And you should have a backup. Always. Not just when upgrading.
    – user334639
    Oct 25, 2017 at 15:31
  • 2
    Possible duplicate of How to reinstall ubuntu and preserve home directory
    – Panther
    Oct 25, 2017 at 16:17

2 Answers 2

0

IMHO if your data is important enough to encrypt it is important enough to backup and you need a backup strategy for encrypted data.

You can start with this (run from home directory):

tar -cvpzf backup.tar.gz \
 /home/.ecryptfs/*/.ecryptfs \
--exclude=./backup.tar.gz \
--exclude=./.gvfs \
--exclude=./.cache \ 
--exclude=./.local/share/Trash ./

You may be able to exclude additional items in $HOME, up to you. Canidates for exclusion might include .thumbs and .themes and .icons. Alternately you can only include the data you want

cd ~
-cvpzf backup.tar.gz Documents Other_directory 1 Other_directory 2 ./

Note: /home/.ecryptfs/*/.ecryptfs is your configuration , take care when restoring the archive, you may wish to skip that file or back it up separate.

Then encrypt

gpg -c backup.tar.gz

To decrypt

gpg -d backup.tar.gz.gpg

Check the backup works, then, rm backup.tar.gz

Better you can script the whole process ;)

With a working backup you can try upgrading or installing preserving $HOME and if it fails for any reason, fresh install and restore from backup.

How to reinstall ubuntu and preserve home directory

When you reinstall, use the same UID and password as with your current install.

You should see a dialog as you install . Notice how the installer is recognizing your previously encypted home and the dialog to select encrypt home and automatic log in are greyed out:

enter image description here

IMHO the biggest "problem" with encryption is people forget they need an encrypted backup in the event of failure, it is not if you will have a system failure, but when it happens, are you prepared with a working backup.

1
  • Sorry for downvoting, but this answer is mainly about backups, which wasn't the topic of the question. Was even entirely about backups, when I downvoted it
    – vucalur
    Oct 28, 2017 at 11:05
-1

Short:

The suggestion was wrong.
Ubuntu DOES take care of that automatically.

Long:

I mistakenly assumed that the problems described under the first link were happening despite using the same username and password combination.

It seems that some other combination was used, and a fresh install reuses encrypted $HOME quite seamlessly.

Encryption options will be disabled during the reinstall process:

enter image description here Kudos to @Panther for showing me the thread about disabled encryption options in a comment below.

5
  • 1
    This is not an answer and you should update your question rather then posting additional information an "answer".
    – Panther
    Oct 25, 2017 at 16:42
  • The installer should take care of this automatically - askubuntu.com/questions/291986/… . If it does NOT I would make a backup prior to installing.
    – Panther
    Oct 25, 2017 at 16:46
  • Please take a look at my second comment to the post with the question. I think more users will have this very doubt: "Does Ubuntu handle encrypted home folder seamlessly during reinstall?". Pardon me, but this is NOT straight-forward, "fundamentally same" process. If that's not the answer, than nothing is.
    – vucalur
    Oct 25, 2017 at 16:47
  • The "problem" is you are making an assumption. The installer handles an encrypted home seamlessly. i.stack.imgur.com/nhPyL.png . Notice how the encrypt home and automatic log in are greyed out. It can fail. Or you may have found a bug. Regardless, other than a back up, there is nothing further required from you other than what is outlined in askubuntu.com/questions/662603/… .
    – Panther
    Oct 25, 2017 at 16:51
  • 1
    @Panther this is very helpful. Thanks! That is in fact more relevant to the post than the duplicate suggested earlier. I think that the question should not be closed as a duplicate. Users that are a bit more cautious will do some research prior to reinstalling and (hopefully) find information here useful. They will never see the form with encryption options disabled, unless they decide to give it a shot and see what happens. "it" = careless reinstalling.
    – vucalur
    Oct 25, 2017 at 16:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .