Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to decrypt a file using the following command within a unix shell prompt:

gpg --passphrase-file /path/to/passphrase/file --output /path/to/output/dir/full_db_restore --decrypt full_db_backup_current.tar.gpg

I get the following error when running the command above:

gpg: 3DES encrypted data
gpg: problem with the agent: No pinentry
gpg: encrypted with 1 passphrase
gpg: decryption failed: No secret key

I have verified that pinentry is installed. I'm not sure if pinentry is the issue. I have a feeling it might be with the "No secret key" error. Any help would be appreciated.

share|improve this question

migrated from stackoverflow.com May 5 '11 at 1:03

This question came from our site for professional and enthusiast programmers.

    
good question but I think it should be moved to superuser, because that's not a programming related question. –  Heisenbug May 3 '11 at 14:56

2 Answers 2

I've discovered a solution to this.

/usr/bin/gpg --no-tty --batch --passphrase-file /path/to/passphrase/file --output   \
/path/to/output/dir/full_db_restore --decrypt full_db_backup_current.tar.gpg

The only difference is that I've added --no-tty and --batch options. After logging onto my unix server, I switch users from userA to userB. I'm assuming that because I switch users, there was an error. I'm not sure if this is the write solution as the options mentioned above are used when calling the command from a shell script. Any additional information would be greatly appreciated. Thanks in advance.

share|improve this answer

You must to use this command:

    gpg --batch --passphrase-fd 1 --passphrase-file /path/to/passphrase/file  
    --output /path/to/output/dir/full_db_restore full_db_backup_current.tar.gpg

--batch: is used in scripts for non-interactive mode (no asking);

--passphrase-fd 1 together with --passphrase-file: to read the passphrase from a file.

If you use only --passphrase-file on *nix it will not work.

Good luck.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.