Wednesday 9 June 2010

Encrypted external drive

Skip to the lines below:

From http://www.hermann-uwe.de/blog/howto-disk-encryption-with-dm-crypt-luks-and-debian

and

http://www.ossramblings.com/ubuntu_external_encrypted_hard_drive


1. Overwrite the drive with random data to slow attacks and scan for badblocks.

badblocks -c 10240 -s -w -t random -v /dev/sdc

2. Install requirements, apply without restart.

sudo apt-get install cryptsetup hashalot hal pmount ivman
sudo modprobe dm-crypt

3. Replace the partition:
sudo cryptsetup --verbose --verify-passphrase luksFormat /dev/[your partition]

This resulted in the partition being considered to be of type, `crypto_LUKS'.
Mounting it does not work, and the next step of the tutorial,

sudo mkfs.ext3 -j -m 1 -O dir_index,filetype,sparse_super /dev/mapper/luks_crypto_b6c6e0ae-4ec3-4ff9-9a7e-c1edf104d8e3

did not work as /dev/mapper is only showing `control'. Stumped. Try the other site.

4. cfdisk /dev/sdc1

-----------------------------------------------------

Days later, try again: this worked.

sudo apt-get install cryptsetup
sudo cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb # Encrypt the partition
sudo cryptsetup luksOpen /dev/sdb sdb # attach it.
sudo mkfs.ext3 /dev/mapper/sdb # create filesystem
sudo cryptsetup luksClose sdb # close it.

Pull out the cable. Wait. Push back in. Provide password, then:

sudo chown me /media/driveLabel/ # change ownership from root.

And, bingo! Modified from http://www.emcken.dk/weblog/archives/164-encrypted-usb-drive-in-ubuntu.html


Alternatively, from the command line:

Plug in.
sudo cryptsetup luksOpen /dev/sde sde # Create decrypted device called /dev/mapper/sde
sudo mount /dev/mapper/sde /mnt/tmp # mount decrypted device

Gotta love linux. :)

No comments:

Post a Comment