Installing Debian 8 (Jessie) with LUKS Encrypted /home and /var Partitions

This tutorial will guide you on installing latest release of Debian 8 (codename Jessie) with /home and /var LVM partitions encrypted on top of a LUKS encrypted physical volume.

LUKS, an acronym for Linux Unified Key Setup, offers a standard for Linux hard disk block encryption and stores all the setup data in the partition header. If somehow, the LUKS partition header is tampered, damaged or overwritten in any way, the encrypted data that reside onto this partition is lost.

Still, one of the facilities of using LUKS encryption is that you can use a decryption key on the boot process to automatically unlock, decrypt and mount the encrypted partitions, without the need to always type a prompt passphrase at system boot (especially if you are connecting remotely through SSH).

You might ask, why only encrypt the /var and /home partitions and not the entire file system. One argument would be that /home and /var partitions contain, in most cases, sensitive data. While /home partition stores users data, the /var partition stores databases information (typically MySQL database files are located here), log files, websites data files, mail files and other, information that can be easily accessed once a third-party gains physical access to your hard drives.

Requirements

  1. Debian 8 (Jessie) ISO Image

Installing Debian 8 with LUKS Encrypted /home and /var Partitions

1. Download Debian 8 ISO image and burn it to a CD or create a bootable USB drive. Place the CD/USB in your appropriate drive, power on the machine and instruct the BIOS to boot from the CD/USB drive.

Once the system boots up the Debian installation media, choose Install from the first screen and press Enter key to move forward.

Install Debian 8
Install Debian 8

2. On the next steps, select the Language for the installation process, select your Country, configure your keyboard and wait for other additional components to load.

Select Language
Select Language
Select Location
Select Location
Configure Keyboard
Configure Keyboard

3. On the next step the installer will automatically configure your Network Card Interface in case you provide network settings through a DHCP Server.

If your network segment doesn’t use a DHCP server to automatically configure network interface, on the Hostname screen choose Go Back and manually set your interface IP Addresses.

Once done, type a descriptive Hostname for your machine and a Domain name as illustrated on the below screenshots and Continue with the installation process.

Configure Hostname
Configure Hostname
Configure Domain Name
Configure Domain Name

4. Next, type a strong password for root user and confirm it, then setup the first user account with a different password.

Set Root Password
Set Root Password
Create New User
Create New User
Set User Password
Set User Password

5. Now, setup the clock by selecting your physical nearest time zone.

Configure Time
Configure Time

6. On the next screen choose Manual Partitioning method, select the hard drive that you want to partition and choose Yes to create a new empty partition table.

Manual Partitioning
Manual Partitioning
Select Installation Disk
Select Installation Disk
Create Disk Partition
Create Disk Partition

7. Now it’s time to slice the hard drive into partitions. The first partition that will create will be the /(root) partition. Select the FREE SPACE, hit Enter key and choose Create a new partition. Use at least 8 GB as its size and as Primary partition at the Beginning of the disk.

Select Disk Partition
Select Disk Partition
Create New Partition
Create New Partition
Set Partition Size
Set Partition Size
Select Primary Partition Type
Select Primary Partition Type
Select Partition Location
Select Partition Location

8. Next, configure /(root) partition with the following settings:

  1. Use as: Ext4 journaling file system
  2. Mount Point: /
  3. Label: root
  4. Bootable flag: on

When you have finished setting up the partition choose Done setting up the partition and press Enter to continue further.

Create Root Partition
Create Root Partition
If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

19 thoughts on “Installing Debian 8 (Jessie) with LUKS Encrypted /home and /var Partitions”

  1. After step 25 (add the key to encrypted LUKS device and enter the passphrase) the key is not be added to the slot, but I get a message “Failed to open key file”.
    All previous steps went flawless.
    What went wrong?

    Reply
  2. Hi,

    After the last step, to make the system use the key file, I had to :
    update-initramfs -u -k all

    WIthout this command, the passphrase was still asked at boot time.

    But I’m really wondering… how is it secure to store the key on disk, in the case someone get physical access to your hard drive? If I do this on a netbook, and someone steal it, will he be able to unlock the crypted volume after he found this key file??

    Thanks for the tutorial!

    Reply
  3. Mate, you describe the creation of dm-crypt containers, which are not really LUKS. Try changing the pasword on the volume you create (a trivial operation for LUKS), and let us know how it worked.

    Reply
  4. “All sensitive data stored in /home and /var partitions will be highly secured in case someone gains physical access to your machine hard-drive.”
    –> huummm , seriously ?

    Reply
    • @Lemoidului,
      Yes, what’s wrong here? /home contains important user data and /var contains important server logs, these two partitions needs to be secured..Instead finding out errors in the article, appreciate the author for his work hard..

      Reply
  5. IMHO, having a encrypted partition with the encryption key stored in a clear text partition by its side, is useless. A false sense of security.

    Reply
  6. This is just a very simple and convenient trick to automatically decrypt and load the encrypted volume in case you don’t have any physical access to the machine or it’s impossible to access or tamper with the boot sequence in order to manually supply the passphrase.

    Reply
  7. @Chris: Check if the key has been added to the encrypted device slot by issuing cryptsetup luksDump command.Also, and verify the content of /etc/crypttab file and ensure that the correct key with absolute path has been added.

    Reply
  8. Sorry if I missed something, but… what’s the point of having a encrypted partition and storing the encryption password in a unencrypted partition?

    Reply

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.