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.

Whenever I try to use gpg from a console-based environment such as ssh sessions it fails because the GTK pinentry dialog cannot be shown in a SSH session.

I tried unset DISPLAY but it does not help and it does look like a dirty solution anyway. The GPG command line options do not include a switch for forcing the pinentry to console-mode.

Older GPG versions offered a text-based prompt that worked fine in SSH sessions but after the upgrade it just fails.

There is the --textmode command line switch but it does not seem to work and apparently is meant to do something else which is even more misleading.

What would be the proper and clean way of getting plain-text pin entry for remote sessions?

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

To change the pinentry permanently, append the following to your ~/.gnupg/gpg-agent.conf:

pinentry-program /usr/bin/pinentry-curses

Tell the GPG agent to reload configuration:

echo RELOADAGENT | gpg-connect-agent
share|improve this answer
    
Thank you so much! Finally a sane solution! :) –  ccpizza Dec 19 '12 at 10:46
1  
It's not completely "sane". Normally, gpg-agent should itself detect the presence or lack of $DISPLAY and choose the apropriate pinentry... –  grawity Dec 19 '12 at 15:00
    
The agent is most likely capable of detecting the presence of a running xorg. But having a DISPLAY defined does not necessarily mean I can or want to use it, for example, when connected over SSH. –  ccpizza Dec 19 '12 at 17:34
2  
I won't comment on "want". But if you connect over SSH and DISPLAY gets set automatically, then it's usually because you activated X11-over-SSH forwarding which means you can use graphical pinentry promptres... –  grawity Dec 19 '12 at 20:26
    
You are right - I had X11 forwarding enabled. Never thought of the implications, though. Thanks again. –  ccpizza Dec 19 '12 at 21:06
add comment

Your Answer

 
discard

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.