Decrypt filesystem

Decrypt ubuntu filesystem

If you have encrypted your drive with one of the latest ubuntu version, this is how to decrypt using the command line.

A few weeks ago I had a problem with my ubuntu (as usual) and I had no clue how to decrypt my file, which it's encrypted by my company's policy.

Optional: run a live ubuntu if your system is not working properly

First option

Open a terminal and type sudo ecryptfs-unwrap-passphrase. Most of the time this should do it.

Second option

Let's start opening a terminal and typing:

lsblk

Look for your encrypted partition, it might look something similar to:

nvme0n1        259:0    0 953.9G  0 disk
├─nvme0n1p1    259:1    0   512M  0 part
├─nvme0n1p2    259:2    0   488M  0 part
└─nvme0n1p3    259:3    0 952.9G  0 part

Then to decrypt:

cryptsetup luksOpen <path_to_encrypted> <name_for_unencrypted_partition>
# This will prompt a password

For example:

cryptsetup luksOpen /dev/mapper/nvme0n1p3 woile

Once decrypted type again:

lsblk

And you'll see your partition unencrypted, something like this:

nvme0n1        259:0    0 953.9G  0 disk
├─nvme0n1p1    259:1    0   512M  0 part
├─nvme0n1p2    259:2    0   488M  0 part
└─nvme0n1p3    259:3    0 952.9G  0 part
  └─woile 253:0    0 952.9G  0 crypt

Now it's time to mount the new partition

  1. create a directory
  2. mount unencrypted partition
mkdir /media/tmp_mount_location  # (1)
mount /dev/mapper/woile /media/tmp_mount_location  # (2)

That's it, if you go to /media/tmp_mount_location, your files should be there.

This is mostly a mental note for me.

Cheers!

Comments

Comments powered by Disqus