0

I have a problem with gpg key:

curl https://deb.torproject.org/torproject.org /A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
100 19665  100 19665    0     0  53005      0 --:--:-- --:--:-- --:--:-- 53005
gpg: key EE8CBC9E886DDD89: 36 signatures not checked due to missing keys
gpg: /home/abigael/.gnupg/trustdb.gpg : trust base created
gpg: clef EE8CBC9E886DDD89 : public key « deb.torproject.org archive signing key » importée
gpg: Total amount processed : 1
gpg:               imported : 1
gpg: no key of ultimate confidence was found

But:

sudo -i
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -

gpg: warning : nothing exported
gpg: no valid OpenPGP data found
2
  • Are you running the first command as a normal user and the second command as sudo? If so, try running them both as root for consistency.
    – elmerjfudd
    Commented Nov 26, 2019 at 16:02
  • I was running as a normal user. Now I did it as sudo and it works. That's great! Thanks
    – Abigael
    Commented Nov 26, 2019 at 16:55

2 Answers 2

1

The problem seen here is caused by the gpg import being run as an unprivileged user, and thus the key was imported into that user's keyring, while the gpg export was being run as root, and thus was looking for the key to export in root's GPG keyring -- which doesn't have it, because it was never imported into root's keyring in the first place. Thus, the most expedient fix is to obtain a root shell (via sudo -i) before running the curl ... | gpg import ... command, which will import the key into root's GPG keyring, and thus it can be found via the gpg export in the next command.

However, the only part of this sequence that must be run as root is the apt-key add, because allowing unprivileged users to add keys to the system's set of trusted repository keys might be a little insecure. Thus, if operating as an unprivileged user normally, only the apt-key command has to run with elevated privileges via sudo, like so:

gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
0

curl https://deb.torproject.org/torproject.org /A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 19665 100 19665 0 0 53005 0 --:--:-- --:--:-- --:--:-- 53005 gpg: key EE8CBC9E886DDD89: 36 signatures not checked due to missing keys gpg: /home/abigael/.gnupg/trustdb.gpg : trust base created gpg: clef EE8CBC9E886DDD89 : public key « deb.torproject.org archive signing key » importée gpg: Total amount processed : 1 gpg: imported : 1 gpg: no key of ultimate confidence was found But:

sudo -i gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -

gpg: warning : nothing exported gpg: no valid OpenPGP data found

You must log in to answer this question.

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