Skip to content

Instantly share code, notes, and snippets.

@sowbug
Last active January 25, 2023 09:22
Show Gist options
  • Select an option

  • Save sowbug/c7f83140581fbe3e6a9b3ddf24891e77 to your computer and use it in GitHub Desktop.

Select an option

Save sowbug/c7f83140581fbe3e6a9b3ddf24891e77 to your computer and use it in GitHub Desktop.
Making an encrypted DVD image
# All the code from http://billauer.co.il/blog/2010/10/encrypted-iso-dvd-luks-dm-crypt-fedora-linux/
MB_COUNT=100
VOL_NAME=MyVolName
DIR_TO_COPY=/tmp/mydir
# Make a 100MB disk image
dd if=/dev/zero of=disk.img bs=1M count=$MB_COUNT
# become root
sudo su
# write to the image
# ****** NOTE that you'll be prompted three times for a passphrase
losetup /dev/loop1 disk.img && \
cryptsetup luksFormat /dev/loop1 && \
cryptsetup luksOpen /dev/loop1 mybackupdisk && \
genisoimage -R -J -joliet-long -graft-points -V $VOL_NAME -o /dev/mapper/mybackupdisk $DIR_TO_COPY
# close the device
cryptsetup luksClose /dev/mapper/mybackupdisk && \
losetup -d /dev/loop1
# Now you have disk.img that can be burned to a CD/DVD, or just mount it in Linux.
# You'll be prompted for the passphrase each time you mount it.
@sowbug

sowbug commented Nov 18, 2020 via email

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment