> The original command used a combination of cryptsetup and gpg, IIRC. I would
> guess that the gpg part needs to run as the non-privileged user.
You're correct. sudo gpg breaks because sudo switches the context (I don't
remember the technical term) to root, so it goes looking through /root/.gnupg
instead of ${HOME}/.gnupg for a matching key. It's not a showstopper if you
explicitly set --homedir, as in:
$Â sudo gpg --decrypt --homedir=${HOME}/.gnupg myfile.gpg
> I don't know whether this would work with cryptsetup. If you never tested
>cryptsetup with procsubs *without* sudo, then you don't know either.
Doesn't work for me. I get blocking errors where gpg refuses to continue until
cryptsetup starts reading. I even tried setting up cryptsetup to read before
gpg writes (yes, I am that naive). AI suggested moving everything to background
jobs, but then sudo fails because it doesn't have an interactive terminal to
password prompt. There's probably a workaround, but it was getting far more
complicated than my mktemp version, so I abandoned it.
Anyhow, I've escalated my concerns to the sudo mailing list and basically asked
for "process substitution" to appear at least once in sudo's man page.