Open LUKS partition with a file from an USB stick

Could anyone tell me how i could accomplish this task??

I want to unlock the encrypted disks with an USB stick, i want to assign a fixed mount point for it and use an mp3 file from it to unlock the partitions. Is it possible at all?

I guess that would work for 11.1 and 11.2 i guess?

Wll, after little help from uncle Google i finally made it possible lol!

In order to do this you need find the name of Your USB stick, it’s best to use YaST’s partitioner and mount it by ID (it is necessary to mount it by ID in order to preserve the name or mount point from changing then in YaST we assign it some fixed mount point for example /media/disk ).

After that we create a keyfile on that disk like this (as ROOT):

dd if=/dev/random of=/media/disk/keyfile bs=1024 count=1 (count can be more than 1, the file will just be bigger)

After that we assign additional key to our LUKS partition
with that command (as ROOT):

cryptsetup luksAddKey /dev/mapper/cr_sdxY /media/disk/keyfile (where x is the appropriate disk and Y is the appropriate partition)

After that we edit the /etc/crypttab file:

open it with nano (you can also use kdesu kate/kwrite or gnomesu gedit or just with your favourite file editor )

and copy the line(s) and append them a bit lower. Now to be sure that the system checks first for the file we add to the end of those lines above place where the keyfile is so in that case: /media/disk/keyfile luks

In my case it is:

cr_sdb3 /dev/disk/by-id/ata-SAMSUNG_HD501LJ_S0MUJDWQ149725-part1 /media/disk/keyfile luks

After that reboot and test if it works :slight_smile: Good luck!