I'm trying to open a LUKS drive through SSH directly.

ssh root@XX "cryptsetup luksOpen /dev/sdb3 secure

But, no password prompt and it stuck.

debug1: Sending command: cryptsetup luksOpen /dev/sdb3 secure
debug2: channel 1: request exec confirm 1
debug2: callback done
debug2: channel 1: open confirm rwindow 0 rmax 32768
debug2: channel 1: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 1
debug2: exec request accepted on channel 1

Is that something impossible?


For the prompt to work, you need to add -t.

ssh -t root@host cryptsetup luksOpen /dev/thing luksthing

(It also works if you just type out your password when it's "stuck" waiting for input, but it will echo in your local terminal.)

Alternatively, piping the passphrase works well enough:

echo -n 'password' | ssh root@host cryptsetup luksOpen /dev/thing luksthing

And to prevent it leaking to the process list and command history, better put it in a file.

ssh root@host cryptsetup luksOpen /dev/thing luksthing < passwordfile

At which point you might just as well use a truly random keyfile rather than just a simple passphrase.

  • Nice, I don't even need to disable echo in console now. FYI I just found out I can actually input password, only the prompt is missing ;-P – daisy Dec 25 '14 at 2:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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