|# 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) ~/.gnupg/|
|# Also correct the permissions and access rights on the directory|
|chmod 600 ~/.gnupg/*|
|chmod 700 ~/.gnupg|
Glad that this helped to fix the warning.
Line 8 changes the permissions on the files in the ~/.gnupg/* directory to 700. 700 means that only the owner/creator can Read, Write and Execute on the files in the directory. Also group and others cannot perform any operation on the files in the directory.
Line 9 changes the permissions on the ~/.gnupg directory to 600. The 600 directory permission means that only the owner/creator of the directory can Read and Write but can't Execute on the directory. The group and others cannot perform any operation on the directory.