8

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?

1

1 Answer 1

8

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.

1
  • 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, 2014 at 2:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .