Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have gpg-agent running with a cached passphrase for an hour or so. I encrypt my email account passwords for offlineimap IMAP sync utility and have the script pass in the passwords by decrypting them from a GPG-encrypted file.

Since I run offlineimap with systemd as it is a cron job, it will naturally pop-up a pinentry program and ask for the password. I was wondering is there a way to programtically confirm if gpg-agent will need a passphrase so I can query for the information, and gracefully exit the systemd/cron job if interactive passphrase input is required.

Has anyone done this before?

share|improve this question

1 Answer 1

I don't know for sure, but I wonder if it is sensible to have such an option because it could easily misused like:

if gpg_ready_to_work_without_pinentry; then

and you'd not have any chance to detect a misuse. (In fact I even don't like that every program in my login session has access to my possibly unlocked key without a way to check if it's unlocked or not. I found your question on the search for an option to gpg-agent to pop up a confirmation dialog for each usage exactly for this reason.)

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.