# Luks

Page content

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

First we need to generate a key

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

We can then add it to luks

cryptsetup luksAddKey /dev/device keyfile

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

cryptsetup luksOpen /dev/sdb1 external -d  keyfileexternal

A device mapper will be added to

/dev/mapper/external

We can then lock the device again with a

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.