11

I was reviewing the different alternatives I have (like ext4 encryption) but I think all of them are vulnerable for root to just enter into my home account and see what's stored in there, which is something really easy to do when someone gets ahold of the computer.

I'm looking for a way to make my files unaccesible, even for root, even if someone takes on the bare metal. I'm willing to risk losing my data if I forget the key, that's not an issue, it's actually desirable.

3 Answers 3

8
  • eCryptFS can encrypt your home folder (& subfolders), and automatically decrypt with your login passphrase - root can't just change your passphrase, it needs your actual login passphrase. The ecryptfs-migrate-home script/tool can encrypt an existing home, or many distributions can encrypt a home when a new user's created. It's available for most distributions, Debian, Mint & Ubuntu derived, Arch, Gentoo, etc. And is free to expand it's size.

    Or, it can use just a single encrypted "Private" folder too, with ecryptfs-setup-private

  • EncFS encrypts a folder too, but may need more customization for secure auto-decrypt.

  • LUKS or plain dm-crypt uses a container file or device, of a fixed size, not as easy to expand as the above file-based solutions, but it doesn't reveal as much info (file number & approximate size) either

  • TrueCrypt or derivatives work similar to LUKS

  • Many distributions can also be installed with "full disk encryption" (usually using LUKS & LVM), that requires the correct passphrase entered at boot. It's a good solution for a single-user ("personal") computer that doesn't need to reboot all by itself, but on a multi-user computer it would be "decrypted" to every other user too.

0
6

You can use dm-crypt for that. You need to create an empty file which will be used as a storage device. You can create one with a specific size with either dd or for example fallocate:

fallocate -l 512M /home/user/cryptedDevice` 
dd if=/dev/zero of=/home/user/cryptedDevice bs=1M count=512

This will create a 512 MB file in your home directory called cryptedDevice. Then you can set luks on top of that file cryptsetup -y luksFormat /home/user/cryptedDevice With Luks you can easily change size of the container etc.

To open the crypted file you can do: cryptsetup luksOpen /home/user/cryptedDevice someDeviceName

Then you need to format this partition with a file system: mkfs.ext4 -j /dev/mapper/someDeviceName

And after that you can simply mount that device to a folder: mount /dev/mapper/someDeviceName /mnt/.

Reference digitalocean

3
  • Is it possible to mount that file automatically on startup? So, my service could be running even if the machine is rebooted. Mar 11, 2016 at 19:00
  • 1
    Then the file is always decrypted, so it is not the solution you seek for, or I am missing something?
    – mstruebing
    Mar 11, 2016 at 20:32
  • Yeah, it wouldn't work for my scenario. Is there a way to "lock up" a Linux deployment in a way that no one else can access into it? Mar 11, 2016 at 21:11
4

Just a side-note if when running:

cryptsetup -y luksFormat /home/user/cryptedDevice

you get this error:

"Not compatible PBKDF options"

run it with --type luks1

cryptsetup -y luksFormat /home/user/cryptedDevice --type luks1

reference: https://github.com/latchset/luksmeta/pull/10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .