|
|
|
@ -1,7 +1,8 @@ |
|
|
|
# LUKS-Encrypted Disk Images on Linux |
|
|
|
# LUKS-Encrypted Disk Images on Linux |
|
|
|
|
|
|
|
|
|
|
|
## Using your package manager: (apt, etc...) install the following: |
|
|
|
## Using your package manager: (apt, etc...) install the following: |
|
|
|
## Requires: cryptsetup, losetup, mount, umount, findmnt, blkid |
|
|
|
## Requires: cryptsetup [Exmaple:$ sudo apt install cryptsetup] |
|
|
|
|
|
|
|
## As well as: losetup, mount, umount, findmnt, blkid |
|
|
|
## Optional: VBoxManage (VirtualBox), virsh (libvirt) |
|
|
|
## Optional: VBoxManage (VirtualBox), virsh (libvirt) |
|
|
|
|
|
|
|
|
|
|
|
## 1st Make a symbloic link to your bin path: |
|
|
|
## 1st Make a symbloic link to your bin path: |
|
|
|
@ -9,22 +10,36 @@ |
|
|
|
sudo ln -s "$(pwd)/luks-img.sh" /usr/local/bin/ |
|
|
|
sudo ln -s "$(pwd)/luks-img.sh" /usr/local/bin/ |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Make a folder for images and change into it. |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
mkdir -p "$HOME/DiskImages" |
|
|
|
|
|
|
|
cd "$HOME/DiskImages" |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
## Quick Starts |
|
|
|
## Quick Starts |
|
|
|
``` |
|
|
|
``` |
|
|
|
1) Create & mount a new 4 GB encrypted image: |
|
|
|
1) Create & mount a new 4 GB encrypted image: |
|
|
|
sudo luks-img.sh create --file mydisk.img --size 4G |
|
|
|
sudo luks-img.sh create --file mydisk.img --size 4G |
|
|
|
|
|
|
|
|
|
|
|
2) Open & mount an existing image: |
|
|
|
2) Close (unmount, close mapper, detach loop): |
|
|
|
sudo luks-img.sh open --file mydisk.img --mount /mnt/luks |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3) Close (unmount, close mapper, detach loop): |
|
|
|
|
|
|
|
sudo luks-img.sh close --file mydisk.img |
|
|
|
sudo luks-img.sh close --file mydisk.img |
|
|
|
|
|
|
|
|
|
|
|
4) Backup the LUKS header: |
|
|
|
3) Open & mount an existing image: |
|
|
|
|
|
|
|
sudo luks-img.sh open --file mydisk.img --mount /mnt/mydisk |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4) Change DIR perms and change into it. |
|
|
|
|
|
|
|
sudo chown $USER:$USER /mnt/mydisk |
|
|
|
|
|
|
|
cd /mnt/mydisk |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NOW copy data to it, and use it... |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5) Backup the LUKS header: |
|
|
|
sudo luks-img.sh header-backup --file mydisk.img --out mydisk.header |
|
|
|
sudo luks-img.sh header-backup --file mydisk.img --out mydisk.header |
|
|
|
|
|
|
|
|
|
|
|
*) Add a new key using an existing keyfile: |
|
|
|
*) Add a new key using an existing keyfile: |
|
|
|
sudo luks-img.sh add-key --file mydisk.img --keyfile /path/newkey --existing-keyfile /path/oldkey |
|
|
|
sudo luks-img.sh add-key --file mydisk.img --keyfile /path/newkey --existing-keyfile /path/oldkey |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
When Done - Repeat step #2 to CLOSE |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
### If you want to add the image file to a VM: |
|
|
|
### If you want to add the image file to a VM: |
|
|
|
|