Generated image
|| #resource #security #luks

Encrypted LUKS Container

Create an encrypted volume on linux using LUKS

Problem

This page describes how to create an encrypted container on a #linux system using LUKS.

*This is not the same as on-the-fly encryption

Solution

The only software required for this process is cryptsetup. It can be installed with apt:

apt install cryptsetup

All the following commands should be run as root

  1. Create file
fallocate -l 25G /enc

Change the size of the file as necessary. This will determine the available drive space when mounted.

  1. Create LUKS container
cryptsetup luksFormat /enc

Follow the prompts in the command line - including the passphrase to unlock the container.

  1. Setup filesystem
cryptsetup luksOpen /enc enc
mkfs.ext4 /dev/mapper/enc

Once the container has been setup, the root user can mount it with the following commands.

  1. Open container
cryptsetup luksOpen /enc enc

You will be prompted for the passphrase used when creating the volume.

  1. Mount container
mount /dev/mapper/enc /data

Details


Maybe try another one?

Markdown Reference Everything you need to know to get started with Markdown ⌨️
2020.10.15
Showing your work Performance. Image. Exposure.
2024.10.04
FRP Reverse Proxy Proxy requests through a public VPS using FRP
2022.03.12