I have used cryptsetup to encrypt an external hard drive.

I have no problem at using the encrypted hard drive in this way:

/sbin/cryptsetup luksOpen /dev/sdc1 backup   
// typing password   
// mounting the partition   
// doing something   
// unmounting the partition  
/sbin/cryptsetup luksClose /dev/mapper/backup

But my next requirement was to be able to do it without the need of typing a password.

Then I created a binary file with the hash of my password via this command:

hashalot -n 32 ripemd160 > volume_key 

and then:

/sbin/cryptsetup luksOpen -d volume_key /dev/sdc1 backup

but I get this error:

Command failed: No key available with this passphrase.

Any ideas guys?

link|improve this question

11% accept rate
but you never accept answers since your own edit? – Rony May 16 at 15:58
feedback

2 Answers

The contents of the volume_key file will be hashed by cryptsetup, so you don't need to do that yourself?

link|improve this answer
I think this is right; try using your incantation again, but put the passphrase itself in volume_key. – MadHatter Dec 14 '10 at 17:49
feedback

cryptsetup man page suggests the following about the -d parameter: "If you want to set a new key via a key file, you have to use a positional arg to luksFormat or luksAddKey."

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.