gpg script to remove passphrase from secret key

Kai-Min Sung kaisung at
Tue Mar 29 04:43:12 CEST 2005

Nevermind, I think I figured it out.  Here's the command to use:

gpg --status-fd 1 --command-fd 0 --edit-key user at < input

and here's the input file:

---input start---


---input end---

Replace the first blank line with a new passphrase if you want to
change the passphrase instead of removing it.


On Mon, 28 Mar 2005 17:27:23 -0800, Kai-Min Sung <kaisung at> wrote:
> Hi,
> I'm trying to write a script that will remove the passphrase from a
> secret key.  Here's the command I'm using:
> gpg --passphrase-fd 0 --command-fd 0 --edit-key user at < input
> The input file looks like:
> ---input start---
> oldpassphrase
> passwd
> save
> quit
> Y
> ---input end---
> gpg doesn't seem to be reading the new passphrase from fd 0. The man
> page says --passphrase-fd will only work if you're using one
> passphrase, which is probably why this fails. Is there any other way
> to make this work?
> Thanks in advance,
> -Kai

More information about the Gnupg-users mailing list