lee
lee

Reputation: 195

Permission issue in WSL2 and gnupg

I'm trying to generate GPG key and move that key to outside of WSL2.

  1. Generate GPG key and its revocation cert in WSL2
  2. Export keys to Windows by command below:

gpg2 --export-secret-keys --armor "GPG_PUBLIC_ID" > ~/secret-key.asc

This command successfully generates .asc file with permission -rw-r--r-- And my destination directory(/mnt/c) has permission of drwxrwxrwx

So permission seems sufficient. However, export has failed when the key is exported to outside of WSL or copied to outside of WSL.

gpg2 --export-secret-keys --armor "GPG_PUBLIC_ID" > /mnt/c/secret-key.asc

This command gives error as follows: zsh: permission denied: /mnt/c/secret-key.asc

I'm using Ubuntu 20.04 and package manager is updated.

Upvotes: 0

Views: 1112

Answers (1)

Philippe
Philippe

Reputation: 26687

Root directory fo Windows (C:\) has higher security contraints than other directories. drwxrwxrwx might not reflect real permission in Windows. You should not write files in Windows root directory unless you have a very strong reason to do so.

Try

gpg2 --export-secret-keys --armor "GPG_PUBLIC_ID" > /mnt/c/temp/secret-key.asc
# Create C:\temp in Windows if it does not exist.

Upvotes: 2

Related Questions