But if I do
cat file | ssh -T ...
where "file" is a text file just containing the passphrase,
I get an error:
X11 forwarding request failed on channel 0
Please unlock disk nvme0n1p3_crypt
cryptsetup: cryptsetup failed, bad password or options?
What could be the cause?
wrote:
On 2026-07-06 16:11:11 +0200, Vincent Lefevre wrote:
But if I do
cat file | ssh -T ...
where "file" is a text file just containing the passphrase,
I get an error:
X11 forwarding request failed on channel 0
Please unlock disk nvme0n1p3_crypt
cryptsetup: cryptsetup failed, bad password or options?
What could be the cause?
I've eventually found the issue. This is due to the newline character
after the passphrase, which cryptroot-unlock doesn't remove! I could
confirm with "echo -n <passphrase> | ssh ...", which works.
I've reported the bug:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1141580
(I thought I had tried with "printf %s <passphrase>" earlier,
but I may have made a mistake in my test.)
On Mon, Jul 6, 2026 at 11:52?AM Vincent Lefevre <vincent@vinc17.net> wrote:
I've eventually found the issue. This is due to the newline character
after the passphrase, which cryptroot-unlock doesn't remove! I could confirm with "echo -n <passphrase> | ssh ...", which works.
I've reported the bug:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1141580
(I thought I had tried with "printf %s <passphrase>" earlier,
but I may have made a mistake in my test.)
It feels like something like IFS=$'\n\0' should be used somewhere, but
I guess not.
In your bug report, you mention that you didn't want to use
"echo -n <passphrase>" on a multi-user system. Presumably, this is
because you want to avoid having the passphrase visible in "ps" or
similar process listings. But echo is a shell builtin, in both bash
and dash. Because it's a shell builtin, it will not be visible as a
process.
That said, "printf %s" is superior to "echo -n", because "echo -n" will potentially interpret some of the characters in its argument. "printf %s"
is guaranteed not to do so. And printf is also a shell builtin, in both
bash and dash, so it's also safe from being listed as a processm, just
like echo.
Shell variables are stored as C strings, in which the NUL byte marks
the end of the string.
| Sysop: | Jacob Catayoc |
|---|---|
| Location: | Pasay City, Metro Manila, Philippines |
| Users: | 4 |
| Nodes: | 4 (0 / 4) |
| Uptime: | 497102:26:32 |
| Calls: | 182 |
| Files: | 744 |
| D/L today: |
65 files (9,837K bytes) |
| Messages: | 73,659 |