On 29/10/2007 octane indice wrote: > I'm reading tutorials for cryptsetup and I don't succeed to give passphrase > through a shell variable. A sort of: > > #! /bin/bash > echo -n your password > read PWD > (...some stuff I do with PWD...) > cryptsetup create $PWD crypted_sda1 /dev/sda1 > (no keyboard confirmation or whatever) > > I really need to do something like that. Is there a way? Hey Octane, First, you might need to read the PWD as 'raw input', with backslash escaping disabled (-n). Also you might want to use -s for not echoing the input. The second mistake is at the invokation of cryptsetup. Please read the manpage of cryptsetup for learning about how to use it properly. One solution for you would be: #!/bin/bash read -rs -p "Your password: " PWD echo -n $PWD | cryptsetup -d - create crypted_sda1 /dev/sda1 PWD= > It's for mounting through initramfs the crypted partition. > > I could do something like: > read PWD > echo $PWD > $PWD > cryptsetup create -d $PWD crypted_sda1 /dev/sda1 > but I find this really ugly. Is there a better way? Which linux distribution do you use? many already have a standarized way to start cryptsetup on encrypted disks during the boot process. ... jonas --------------------------------------------------------------------- dm-crypt mailing list - http://www.saout.de/misc/dm-crypt/ To unsubscribe, e-mail: dm-crypt-unsubscribe@xxxxxxxx For additional commands, e-mail: dm-crypt-help@xxxxxxxx