0

When I installed Ubuntu 19 it offered to encrypt the disc where I have my /home partition. I chose that because I thought my data would be safer.

For different reasons I was not happy with Ubuntu 19, so I installed Ubuntu 18, leaving the /home disc untouched.

Now it is impossible to mount the disc though. I had to make a /home directory on the (smaller) system disc to continue at all. Now mounting the old disc as /home2 I managed to get to this point:

root@host:/home2# ecryptfs-unwrap-passphrase /home2/.ecryptfs/user/.ecryptfs/wrapped-passphrase 
Passphrase: ********
2abd39dc3693535ca43a2bf40691f5b9  

root@host:/home2# sudo ecryptfs-add-passphrase --fnek
Passphrase: 
Inserted auth tok with sig [934485b75a55371a] into the user session keyring 
Inserted auth tok with sig [ec2a4a6c55ccb30f] into the user session keyring

and then proceeded to mount with:

root@host:/home2# sudo mount -t ecryptfs /home2/.ecryptfs/user/.Private /mnt/
Passphrase: 
Select cipher: 
 1) aes: blocksize = 16; min keysize = 16; max keysize = 32
 2) blowfish: blocksize = 8; min keysize = 16; max keysize = 56
 3) des3_ede: blocksize = 8; min keysize = 24; max keysize = 24
 4) twofish: blocksize = 16; min keysize = 16; max keysize = 32
 5) cast6: blocksize = 16; min keysize = 16; max keysize = 32
 6) cast5: blocksize = 8; min keysize = 5; max keysize = 16
Selection [aes]: 
Select key bytes: 
 1) 16
 2) 32
 3) 24
Selection [16]: 
Enable plaintext passthrough (y/n) [n]: n
Enable filename encryption (y/n) [n]: y
Filename Encryption Key (FNEK) Signature [934485b75a55371a]: 
Attempting to mount with the following options:
  ecryptfs_unlink_sigs
  ecryptfs_fnek_sig=934485b75a55371a
  ecryptfs_key_bytes=16
  ecryptfs_cipher=aes
  ecryptfs_sig=934485b75a55371a
Mounted eCryptfs

which looks hopeful. But then when I go into /mnt I get

root@host:/home2# ls /mnt/
ls: cannot access '/mnt/Public': No such file or directory
ls: cannot access '/mnt/Handboek Communicatiestijl.pdf': No such file or directory
ls: cannot access '/mnt/Videos': No such file or directory
ls: cannot access '/mnt/home': No such file or directory
ls: cannot access '/mnt/Music': No such file or directory
ls: cannot access '/mnt/Desktop': No such file or directory
ls: cannot access '/mnt/Templates': No such file or directory
ls: cannot access '/mnt/Documents': No such file or directory
ls: cannot access '/mnt/Downloads': No such file or directory
ls: cannot access '/mnt/Pictures': No such file or directory
ls: cannot access '/mnt/projects': No such file or directory
ls: cannot access '/mnt/work': No such file or directory
ls: cannot access '/mnt/NVIDIA_CUDA-10.1_Samples': No such file or directory
ls: cannot access '/mnt/homedir': No such file or directory
 Desktop                         NVIDIA_CUDA-10.1_Samples
 Documents                       Pictures
 Downloads                       projects
'Handboek Communicatiestijl.pdf' Public
 home                            Templates
 homedir                         Videos
 Music                           work

So the ls command does end up showing the names, but first it says no such file or directory (even though it does recognise files from directories). And I cannot enter the directories or access files -- their permissions all look like this

drwx------ 29 user user 12288 okt 21 15:26 ./
drwxr-xr-x 25 root root  4096 okt 22 14:39 ../
-?????????  ? ?    ?        ?            ? .hiddenfile
d?????????  ? ?    ?        ?            ? directory
-?????????  ? ?    ?        ?            ? normalfile
l?????????  ? ?    ?        ?            ? link

So getting until here gives me the idea that I provide the right passwords etc, but why doe the files and their permissions end up being changed?

Does anyone know if this can be solved by different (encryption) options or by using a different version of ecryptfs?

0

You may want to reboot with a Ubuntu 19 live CD, mount the partitions with your ecryptfs password, and then instruct it to decrypt the filesystems and reconvert them to unencrypted ext4fs. Then dismount the volumes, and reboot in Ubuntu 18.

But may be you could also install ecryptfs as an addon on Ubuntu 18. Basically this should work provided you have the correct minimum kernel version (Linux kernel versions are independant of the Ubuntu distribution which just requires a minimum supported kernel, which can be updated separately of other packages supported by the versioned Ubuntu environment.

Note: I've not checked if ecryptfs was backported in the list of packages supported in Ubuntu 18. And anyway most changes in the new default Ubuntu 19 distribution can be reverted, including the desktop manager if you don't like the new one as Ubuntu 19 supports almost all packages built for Ubuntu 18. This is done in many other Ubuntu-based distros that make other choices of default packages.

Make sure also that Ubuntu 18 uses the updated kernel: go to the Software manager, select the Kernels versions menu, and apply the newest one.

| improve this answer | |
  • Thanks for this! The strange thing is: when I installed Ubuntu 19 they gave this encryption option, but it's not available on the live CD (you have to install the packages). The files are still unreachable (although the top level directories / files are shown). The password I gave is right (others just don't work). If you have any idea what else might work I'd be thrilled to know! – alle_meije Oct 24 '19 at 21:02
0

After the successful execution of mount -t ecryptfs try:

sudo ecryptfs-recover-private /home2/.ecryptfs/user/.Private

It should decrypt the files of your old home folder (currently mounted as /home2) and make them available in a temporary folder named something like: /tmp/ecryptfs.xyz12345

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.