This key was created by an individual user and exported for a generic user. Encryption is working, but decryption fails. I tried many options, but none of them is working. Secret keys are showing while listed with a generic user.
Error while decryption: Gpg: public key decryption failed: Permission denied gpg: decryption failed: No secret key
I have not faced this issue with the previous gpg version 2.0X
Sorry, there is a typo in the previous post. I have corrected it in the post. Key import is not an issue. While doing decryption: Gpg: public key decryption failed: Permission denied gpg: decryption failed: No secret key : using this command : gpg --batch --passphrase “xyz” abc.txt.gpg. Later, I used this command for decryption: gpg --pinentry-mode loopback --output abc1.txt --decrypt abc1.txt.gpg it worked somehow. now gpg --batch --passphrase “xyz” abc1.txt.gpg command is also working. I am not sure what happened suddenly. I have not changed permission etc. gpg-agent cached your passphrase after a successful operation (import/decrypt) ? Decryption issue will come again with gpg --batch --passphrase “xyz” abc1.txt.gpg ?
Hi @sunilshri85,
from your last message I am not sure that is working and what is not working now for you.
One general rule is: If you need to fully automate the decryption, you can use a private key without passphrase and then secure your operating environment accordingly. This way you avoid piping in a passphrase via --passphrase-fd or similiar.
[quote=“sunilshri85, post:3, topic:7108”]
Sorry, there is a typo in the previous post. I have corrected it in the post. Key import is not an issue. While doing decryption: Gpg: public key decryption failed: Permission denied gpg: decryption failed: No secret key : using this command : gpg --batch --passphrase “xyz” abc.txt.gpg.[/quote]
You need to add --pinentry-mode loopback. So in total: