Disposable Encrypted Partition

maaboo

I'd like to create one-time encrypted partition with a random key which will be wiped on reboot. I found a manual about swap encryption, but swap is just a block device which doesn't have any file system on it. Also I found full system encryption which is unacceptable, I want only one partition. Both methods are not my case.

How to create one? As far as I understand (I'm not Linux professional) I can't directly use fstab/crypttab directly because I need to format the partition after creation every time when the machine is booting up. A kind of script? Are there any pitfalls?

EDIT: Not sure if type of encryption (block/filesystem) matters so long as any saved data is encrypted. If distrib matters: Debian Stretch. TLDR: I want clean ext4 partition mounted somewhere after reboot which data is encrypted by random key.

derobert

Swap is actually very close to what you want — with swap, you put the swap flag in /etc/crypttab, which tells the boot up scripts to run mkswap on the block device at boot.

You basically want the same thing, but with mkfs instead of mkswap. At least here, that's already supported with the tmp[=fstype] flag. You can check the manual page (man 5 crypttab) to see what's supported on your system.

So, this should work:

some_name /dev/sdaX /dev/urandom cipher=aes-xts-plain64,size=512,tmp=ext4

and then in /etc/fstab, you'd mount /dev/mapper/some_name wherever.

BTW: An alternative is tmpfs, which keeps the data in memory. Probably swapable, though, so you'll need either no swap or encrypted swap.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Extending a luks encrypted partition

From Dev

How secure is an encrypted partition?

From Dev

How to create an encrypted partition?

From Dev

Is the swap partition encrypted?

From Dev

How secure is an encrypted partition?

From Dev

How to create an encrypted partition?

From Dev

Is the swap partition encrypted?

From Dev

Extending a luks encrypted partition

From Dev

Is my swap partition encrypted?

From Dev

Change encrypted partition UUID

From Dev

Remove TrueCrypt encrypted partition

From Dev

Mount an encrypted partition

From Dev

Shrink encrypted home partition

From Dev

Access encrypted drive on separate partition

From Dev

Mount encrypted partition of an image file

From Dev

LUKS encrypted flash drive: no partition table

From Dev

Recovering a LUKS encrypted partition from dump

From Dev

Prevent encrypted partition from running on other PC

From Dev

How to compress an encrypted partition or drive in Windows?

From Dev

GParted doesn't find partition in encrypted drive

From Dev

Is the Windows paging file safe in the encrypted partition?

From Dev

Access encrypted partition from Linux and Windows

From Dev

Data access speed in LUKS encrypted partition

From Dev

how to recover lost encrypted partition (bitlocker)?

From Dev

How to recover encrypted partition after dd command

From Dev

Decrypt encrypted disk to make second partition

From Dev

Extend a LUKS encrypted partition to fill disk

From Dev

Filesystem recovery of dm-encrypted partition fails

From Dev

Partition still encrypted with luks after wipefs