0

I'm trying to migrate a (PHP) software module into a new server (from a CentOS 6.9 to an Ubuntu 16.04). In a certain part of a process, the code tries to launch the following command:

gpg --no-tty --sign --encrypt --armor --passphrase=whatever --local-user A188E1E4! --recipient A188E1E4

So I'm trying to export the private/public key pair from the working server.

I'm stuck at this point, I've tried to manage it with this very similar question but I don't know the name and path where the key should be.

I've tried to run gpg --list-keys but:

gpg: directory '/home/my-username/.gnupg' created

gpg: new configuration file /home/my-username/.gnupg/gpg.conf' created

gpg: WARNING: options in '/home/my-username/.gnupg/gpg.conf' are not yet active during this run

gpg: keyring '/home/my-usernameo/.gnupg/pubring.gpg' created

gpg: /home/my-username/.gnupg/trustdb.gpg: trustdb created

I don't know which user is the code using to launch the command. Maybe I would need a way to list all the keys, not only the current user, so I can see which key I need to export.

0

gpg will try to load the keys from ~/.gnupg and will not list "All keys in the system" as each user has a separate keyring. You cannot do this.

In your case the gpg application will try to list the keys from www-data, php or what is the name of the user that owns the php process.

You can change the location of the keys by manipulating the GNUPGHOME or HOME environment variable, or by setting the --homedir to gpg. This option is not available in all gpg versions.

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.