LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-06-2021, 08:53 PM   #1
GrovesP
LQ Newbie
 
Registered: Dec 2021
Posts: 3

Rep: Reputation: Disabled
ecryptfs: Recovering Private Files After .ecryptfs File Deleted


Leveraging Linux Mint 20.2 (Ubuntu/5.4.0-86 x86_64) with an older copy of an encrypted drive available via USB. Managed to get the encrypted drive mounted and the volume decrypted. However, when attempting to remount the 'private,' home directory, both the '.ecryptfs' and '.Private' files were deleted. All the passphrases are available.

Now, when attempting to mount the private home directory. The two deleted files are causing an error: "Encrypted file is not setup correctly." Obviously, I wasn't able to recover the files. (TestDisk) None of the other encrypted archives were touched, but still the error without the index. Hoping that '.Private,' isn't required for reconstruction.

Is there a way to rebuild the index (assumption about .ecryptfs) with only the archives, themselves? Any way to recover the private directory or should I just wipe the drive?
 
Old 12-07-2021, 01:31 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,161

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
Quote:
Originally Posted by GrovesP View Post
... both the '.ecryptfs' and '.Private' files were deleted.
Erk. My understanding is that the .Private directory (not a file) is where the encrypted data exist. The .ecryptfs has some nice-to-have files (like the wrapped key), but you can live without them. But if the data are gone you are toast.
As I have never used it, I'm happy to be proved wrong.
Quote:
None of the other encrypted archives were touched
What does this mean - show us a list.
 
Old 12-08-2021, 09:32 AM   #3
GrovesP
LQ Newbie
 
Registered: Dec 2021
Posts: 3

Original Poster
Rep: Reputation: Disabled
Sorry for the Confusion

Appreciate the response.

Quote:
Erk. My understanding is that the .Private directory (not a file) is where the encrypted data exist. The .ecryptfs has some nice-to-have files (like the wrapped key), but you can live without them. But if the data are gone you are toast.

As I have never used it, I'm happy to be proved wrong.
Yeah, that's my understanding as well. But, I was hoping that while the '.Private,' directory has the encrypted containers, the '.ecryptfs,' directory has an index in that file that won't let me mount them. Sorry for the misunderstanding in my original post -- I'll use just the filename (.ecryptfs) and add a slash when I'm describing the directory since they're identically named. (.ecryptfs/)

Quote:
What does this mean - show us a list.
The two directories (.ecryptfs/ and .Private/) are both intact with the exception of the FILES of the same name within those directories. So, the following files were deleted:
  • .ecryptfs/.ecryptfs
  • .Private/.Private

Attachment has file listing for both directories. The symbolic links appear broken, but that is most likely because it's mounted under 'media,' and not its usual location.

Thanks, again.
Attached Files
File Type: txt ecryptfs.files.txt (12.5 KB, 22 views)
 
Old 12-09-2021, 10:44 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,161

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
Yeah, I though you might have encrypted filenames as well as the data itself. You'll need to add the filename encryption key to your keyring. Have a read of this, seems to cover it for Mint.
 
Old 12-10-2021, 11:22 AM   #5
GrovesP
LQ Newbie
 
Registered: Dec 2021
Posts: 3

Original Poster
Rep: Reputation: Disabled
Solved

SOLVED!

Thanks for the help - the missing step was the keyring, and I think my confusion was based on using a (newly created) user with the same login as the original owner. Either way, adding the Mount Passphrase to the keyring and using the appropriate identifier when mounting the share did the trick. That said, I still have no idea what those two files were that we deleted... were they important at all?

Have a great weekend.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Recover deleted .ecryptfs folder using extundelete in Ubuntu ambivalent Linux - Newbie 23 09-17-2012 03:51 AM
[ECRYPTFS] ecryptfs_init_miscdev: Error whilst attempting to open [/dev/ecryptfs] nitinarora Linux - Kernel 0 03-22-2010 05:36 AM
Frontend for recovering deleted files from ext3 filesystem jayakrishnan Linux - General 3 12-16-2004 02:21 PM
Recovering Deleted Files Brian of Gep Linux - Newbie 1 03-02-2004 02:26 AM
Need Help Fast...recovering Deleted Files dowdnt Linux - General 1 07-09-2003 09:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration