Skip to content

Instantly share code, notes, and snippets.

@asakura42
Forked from oseme-techguy/Correct_GnuPG_Permission.sh
Last active November 27, 2020 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asakura42/ce829fa3898ab3ecf062824059a84351 to your computer and use it in GitHub Desktop.
Save asakura42/ce829fa3898ab3ecf062824059a84351 to your computer and use it in GitHub Desktop.
This fixes the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error while using Gnupg .
#!/bin/bash
# To fix the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error
# Make sure that the .gnupg directory and its contents is accessibile by your user.
chown -R $(whoami) "${GNUPGHOME:-$HOME/.gnupg}/"
# Also correct the permissions and access rights on the directory
chmod 600 "${GNUPGHOME:-$HOME/.gnupg}/*"
chmod 700 "${GNUPGHOME:-$HOME/.gnupg}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment