gpg: WARNING: unsafe permissions on configuration file `/home/david/.gnupg/gpg.conf'
gpg: WARNING: unsafe enclosing directory permissions on configuration file `/home/david/.gnupg/gpg.conf'
gpg: external program calls are disabled due to unsafe options file permissions
gpg: keyserver communications error: general error
gpg: keyserver receive failed: general error
What does it mean and how to fix?
Best Answer
This means that your
~/.gnupg/gpg.conf
has unexpected permissions for the user you are running as, like write access to "others", another user or the executable bit. This file should always for security reasons only be readable and writable by the user, and no one else:Yours probably has different user or permissions. Check them out using
ls -l ~/.gnupg/gpg.conf
. To fix this is simple enough:If some of the commands fails, or you keep getting the error message you mentioned after following these instructions, you should delete the
~/.gnupg
directory, because it cannot be trusted anymore.You can then try to run
gpg
command with the same user that is going to run the script, this way your user with create~/.gnupg
directory with appropriate permissions.