Last active
December 11, 2015 07:17
-
-
Save taoy/aa09e79070f745fe9b3f to your computer and use it in GitHub Desktop.
mount-encrypted file on debian
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo /sbin/losetup /dev/loop2 ~/Documents/.encrypt/encrypted.img | |
sudo /sbin/cryptsetup luksOpen /dev/loop2 encrypted | |
sudo mount -t ext4 /dev/mapper/encrypted ~/Documents/drive/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo umount /dev/mapper/encrypted | |
sudo /sbin/cryptsetup luksClose encrypted | |
sudo /sbin/losetup -d /dev/loop2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create image file for encrypted device | |
$ dd if=/dev/zero of=$HOME/Documents/.encrypted/encrypted.img bs=32K count=6480 | |
# Assign image file to loop device | |
$ sudo /sbin/losetup /dev/loop2 ~/Documents/.encrypted/encrypted.img | |
# Crypt setup the associated device (the file) | |
$ sudo /sbin/cryptsetup luksFormat /dev/looop2 | |
# Open the file as a device. | |
$ sudo /sbin/cryptsetup luksOpen /dev/loop2 encrypted | |
# Format. | |
$ sudo /sbin/mkfs -t ext4 /dev/mapper/encrypted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment