Skip to content

Instantly share code, notes, and snippets.

@linux-modder
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linux-modder/e8ef306daf27512adc5c to your computer and use it in GitHub Desktop.
Save linux-modder/e8ef306daf27512adc5c to your computer and use it in GitHub Desktop.
Recover your encryptfs.Private /home
###From another gist member
USING ecryptfs-recover-private TO RECOVER ENCRYPTED HOME IN MINT 17 CINNAMON
--------------------------------------
This has saved more than twice when somehow I found myself...without a backup ?!
My setup had encrypted and encrypted home. If you only encrypted home then I believe you can start at:
To find your .Private dir
======================================
If using an encrypted drive (home is separate) you need to mount it first. LiveDistro will mount it auto as luk-xxxxxxxxxxx. Need to unmount it and then remount for it to work correctly.
lblk
sudo cryptsetup luksClose /dev/mapper/luk-xxxxxxxxxxx
lsblk to confirm close
If also using lvm then you need to close the volume group before hand then the luks-UUID luk-xxxxxxxxxxx
sudo vgchange -an VGNAME && luk-xxxxxxxxxxx
lsblk to confirm closed
To reopen the luks (you will need password)
sudo cryptsetup luksOpen /dev/sdX NAMEFORLUKS
password prompt:
I used sda5_crypt since that is lsblk showed in working version. The lv should reappear when..
lsblk
#### This next line I did use a included incase in helps but the ecryptfs-recover mounts it for you when run it
####sudo mount /dev/mapper/mint--vg-root /mnt ???
To find your .Private dir and make sure that it is there:
sudo find / -type d -iname '.Private' 2>/dev/null
Mine returned:
/mnt/home/.ecryptfs/USERNAME/.Private
Now to recover the data with your mint login:
sudo ecryptfs-recover-private
INFO: Searching for encrypted private directories (this might take a while)...
INFO: Found [/mnt/home/.ecryptfs/USERNAME/.Private].
Try to recover this directory? [Y/n]: y
INFO: Found your wrapped-passphrase
Do you know your LOGIN passphrase? [Y/n] y
INFO: Enter your LOGIN passphrase...
Passphrase:
Inserted auth tok with sig [20c8d7b0e21683b5] into the user session keyring
INFO: Success! Private data mounted at [/tmp/ecryptfs.PWSd2T4w].
Now your data is temporarily mount as stated !
DO NOT RUN ANY CLEANING SOFTWARE SUCH AS BLEACHBIT NOW OR IT WILL ERASE THE /tmp
To check if files are there:
sudo ls /tmp/ecryptfs.PWSd2T4w (use the stated one of course)
Backup somewhere like external drive. I used rsync BUT BE AWARE THAT THE LAST DIR LISTED IS WHERE IT IS COPIED TO. IF YOU DONT LIST THE DESTINATION LAST IT WILL OVERWRITE ONE OF YOU WANTED DIRS !!! Also be sure your destination has room for the data.
mint mounted my external drive under /media/mint/DESTINATION
sudo rsync -av /tmp/ecryptfs.PWSd2T4w/Desktop /tmp/ecryptfs.PWSd2T4w/Documents (etc. the rest of your wanted directories) /media/mint/DESTINATION
This can take a loooooong while so be happy and watch a movie or something :D
Since you are using rsync as sudo you will need to change your permission accordingly. Do not try and open files with wrong permission or you may get unwanted side effects. ex) open .html file will open firefox as root and create a firefox profile. All bad.
I reinstalled mint where i wanted it fix permissions and copied files over to working distro.
ALWAYS KEEP A BACKUP AND SECURE IT.
Happy to here you have recovered. Best wishes
links that might help otherwise:
EncryptedPrivateDirectory - Community Help Wiki.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment