LUKS: Difference between revisions

472 bytes added ,  27 July 2020
Line 66: Line 66:
cryptsetup close <name>
cryptsetup close <name>
</pre>
</pre>
==Scripts==
{ hidden | mount_drives.sh |
<syntaxhighlight lang="bash">
#!/bin/bash
function mount_luks {
    local fstype=$1
    local device=$2
    local name=$3
    local mountpoint=$4
    if [ ! -b /dev/mapper/"$name" ]
    then
        sudo cryptsetup open "$device" "$name"
    fi
    sudo mkdir -p "$mountpoint"
    sudo mount -t $fstype /dev/mapper/"$name" "$mountpoint"
}
mount_luks ext4 /dev/disk/by-id/<drive> lukscrypt1 /media/lukscrypt1
</syntaxhighlight>


==Resources==
==Resources==
* [https://www.cyberciti.biz/hardware/howto-linux-hard-disk-encryption-with-luks-cryptsetup-command/ nixCraft How To Linux Hard Disk Encryption With LUKS]
* [https://www.cyberciti.biz/hardware/howto-linux-hard-disk-encryption-with-luks-cryptsetup-command/ nixCraft How To Linux Hard Disk Encryption With LUKS]