33

I am trying to install Pass: the standard Unix password manager, however, when I try to add passwords to the appliation I get these errors

gpg: Kelly's Passwords: skipped: No public key
gpg: [stdin]: encryption failed: No public key

GPG Public Keys?

When I type in the command gpg --list-keys I get:

/home/khays/.gnupg/pubring.gpg
------------------------------
pub   2048R/64290B2D 2012-11-05
uid                  Kelly Hays <hays.kelly@gmail.com>
sub   2048R/0DF57DA8 2012-11-05

I am a little lost of how to remedy this, any ideas?

37

How did you create the password store? pass init "Kelly's Passwords"? If so, this is wrong, you should have called pass init 64290B2D.

And if then pass insert foo will fail with:

gpg: fooo: skipped: public key not found
gpg: [stdin]: encryption failed: public key not found

then you have to trust your own key first (gpg --edit-key 64290B2D, trust, 5, save).

4
  • I'll just add for those who were one step behind like me, you should first init gpg key with gpg --generate-key
    – ItayB
    Jun 19 '17 at 5:43
  • 2
    @ItayB the command to generate a gpg key is actually gpg --gen-key (in gpg 1.4.20)
    – Rubanov
    Jul 13 '18 at 8:17
  • In one case, using gpg (version 1.4.20) under Xubuntu, leads always to failures (generating passwords via pass). Using gpg2 (version 2.1.11) made everything work fine. May 9 '19 at 23:34
  • The 'key', eg 64290B2D, is whatever you used to identify the key, in my case being an email address, revealed as uid with gpg -k
    – John Mee
    May 15 '19 at 23:44
5

With the same indications, if anyone stumbles across this issue, the solution may be bit different. Your pass is using gpg2 instead of gpg, you might have used to generate/manage your keys (or, vice-versa). Verify with:

bash -x $(which pass) insert foo
1
  • 2
    In case one has already generated a with GPG 1 - you can import it into GPG 2 like this: gpg2 --import ~/.gnupg/secring.gpg Apr 15 '17 at 12:19
2

I got the same error for while, running the bash in debug is helping. ( bash -x ), I then realized that pass had listed a non-existing gpg-key in .password-store/.gpg-id

1

I got the same error, but checking with gpg2 --list-keys gives me

pub   rsa4096/0x12345678 2016-11-22 [SC] [expired: 2018-11-26]

So my solution is to

gpg --edit-key 0x12345678
gpg> expire
...
gpg> save

See https://unix.stackexchange.com/a/177310/14315

If you have to renew subkeys use this:

> e.g. if the subkey whose validity you want to extend is the first listed
> subkey, or if it is the only listed subkey, then the  command would be
> Command> key 1
> this will put a * after the word sub, indicating that this particular
> subkey has been selected. then
> Command> expire
> and follow the prompts.

Source https://lists.gnupg.org/pipermail/gnupg-users/2005-June/026063.html

If you get another error while using expire like:

part of private key missing

Try using gpg2 instead of gpg.

0

Remember pass init <gpg-id> used to Initialize new password storage and use gpg-id for encryption. Which you only generate for the first time only.

Whereas pass add <folder/file> is used to add a new password inside the above password storage.

$ pass init tsabunkar (storage-manager should be done first time only)
$ pass add personal/gmail (adding my gmail creds)

Now If you want to add another credential, but rather than :

$ pass add personal/linux

Now again you want to add another credentials, but this time you had used init command instead of add

$ pass init personal/aws/root

but later you realized that option should have been add

$ pass add personal/aws/root

Error Message:

Enter password for personal/aws/root: 
Retype password for personal/aws/root: 
gpg: personal/aws/root: skipped: No public key
gpg: [stdin]: encryption failed: No public key
Password encryption aborted.

I guess now you understand this is because you are referencing to wrong password-store which should have been tsabunkar but not personal/aws/root Therefore to re-referencing back to the correct password-store solves this issue:

$ pass init tsabunkar
$ pass add personal/aws/root

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.