Thatbytes

Mostly Interesting

Luks

After some googling i have worked out how to add keys to a luks,

First we need to generate a key

1
dd if=/dev/urandom of=keyfile bs=1M count=10

We can then add it to luks

1
cryptsetup luksAddKey /dev/device keyfile

Once this is done we can then unlock the device with a key

1
cryptsetup luksOpen /dev/sdb1 external -d  keyfileexternal

A device mapper will be added to

1
/dev/mapper/external

We can then lock the device again with a

1
cryptsetup luksClose external

All i have to do now is get python to run the correct command in sequence and ask for sudo access and then when you add the device it can decrypt it and start the backup process.

Comments