Recover files from encrypted Home folder

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
smssms

Recover files from encrypted Home folder

Post by smssms »

I want to get some files off of my natively encrypted Home folder but I can no longer get Mint to boot - how can I get the files?

BACKGROUND:
Had dual boot with Windows & Mint and all was well.
One day the HDD would not boot at all.
Tried a few things, and Boot-repair run from a Live USB of Ubuntu was the only one that did anything...
Now the HDD will boot into Windows, but there is no sign of Grub or then Mint at startup any more.

I DO have the passphrase for the encrypted partition.

I'm not actually that bothered about saving the Mint install, but I do want the files out of my Home folder.

Appreciate any tips on how to get my files back - Thanks
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
xenopeek
Level 25
Level 25
Posts: 29612
Joined: Wed Jul 06, 2011 3:58 am

Re: Recover files from encrypted Home folder

Post by xenopeek »

These are my notes for recovering access to an encrypted home. Boot from the Linux Mint installation DVD / USB to do this.

Code: Select all

# Mount the disk partition containing the Encrypted Home Directory
# !!! replace /dev/sda1 with your partition !!!
sudo mount /dev/sda1 /mnt

# Establish a proper chroot environment
sudo mount -o bind /dev /mnt/dev
sudo mount -o bind /dev/shm /mnt/dev/shm
sudo mount -o bind /proc /mnt/proc
sudo mount -o bind /sys /mnt/sys
sudo chroot /mnt

# Become the user whose data needs recovery and manually add the necessary mount passphrase to the kernel session keyring
# !!! replace username with your username !!!
su - username
ecryptfs-add-passphrase --fnek

# Mount the encrypted directory and then access the data
ecryptfs-mount-private
cd $HOME
I've used this once successfully, as have at least two other users here. Is this in a format that is usable for you, or do you need more help?
Image
smssms

Re: Recover files from encrypted Home folder

Post by smssms »

Thanks for the quick reply Xenopeek.

I'll have a stab with that and see how it goes. Only problem at the minute is that I do not have a Mint Live USB/CD, so have to sort that first...
smssms

Re: Recover files from encrypted Home folder

Post by smssms »

I can mount the Windows partitions (in terminal and Disk Utility), but not the Linux partitons.

In Disk Utility they just do not have an option to mount and when I try

Code: Select all

sudo mount /dev/sdb5 /mnt
it comes back with

Code: Select all

mount: you must specify the filesystem type
. I tried things like

Code: Select all

mount -t ext4 /dev/sdb5 /mnt 
but still get error messages about wrong filesystem or bad superblock etc...
User avatar
xenopeek
Level 25
Level 25
Posts: 29612
Joined: Wed Jul 06, 2011 3:58 am

Re: Recover files from encrypted Home folder

Post by xenopeek »

Oh boy. Perhaps something more is wrong? What does this command share:

Code: Select all

sudo parted -l
Image
smssms

Re: Recover files from encrypted Home folder

Post by smssms »

OOh, I got one of the linux partitions to mount after 'repairing' the superblock with Testdisk

Code: Select all

sudo fsck.ext4 -v /dev/sdb5
So now I will try your earlier approach to get at my data....
smssms

Re: Recover files from encrypted Home folder

Post by smssms »

Thanks for all your help.

With a bit more work on e2fsck to sort out the superblock I got most of the way through your instructions.

Then I had the opposite of a eureka moment when I realised I had the passphrase for the wrong HDD!!!!!!!

So I'm going to have to hunt down the right passphrase (if I stored it!) or work out how to get in with the system password.
cryptotheslow
Level 1
Level 1
Posts: 34
Joined: Thu Mar 14, 2013 6:30 pm

Re: Recover files from encrypted Home folder

Post by cryptotheslow »

I know this is an old thread, but I thought I would add a useful tidbit of information for those who may look at it in the future.

For a while now ecryptfs provides a utility "ecryptfs-recover-private" that automates the recovery process without having to go through the palaver of chroot etc.

There's a simple walkthrough here:
https://web.archive.org/web/20161216114 ... /Ecryptfs/
smssms

Re: Recover files from encrypted Home folder

Post by smssms »

cryptotheslow wrote:I know this is an old thread, but I thought I would add a useful tidbit of information for those who may look at it in the future.

For a while now ecryptfs provides a utility "ecryptfs-recover-private" that automates the recovery process without having to go through the palaver of chroot etc.

There's a simple walkthrough here:
https://web.archive.org/web/20161216114 ... /Ecryptfs/
Thanks, still not got my data back so I will have a look at that :)
Locked

Return to “Other topics”