Common issues with using GnuPG over SSH from a Mac

Usually, I work directly on my Mac, but sometimes, I have to log into it from another system. By default (at least on MacPorts), the GnuPG agent will default to using the graphical pinentry. Normally, this is good, but if you need to enter your key passphrase, it’ll open on the desktop instead. Oops. To fix this part, add this line (adjusting path as needed) to ~/.gnupg/gpg-agent.conf (maybe need to restart the agent too):

pinentry-program /opt/local/bin/pinentry-curses

Remove this line to go back to using graphical passphrase entry.

Sometimes with this, you might get an error like this with the curses version of pinetry:

gpg: signing failed: Inappropriate ioctl for device

It seems GnuPG might not pick up the right TTY, so you may need to explicitly override it:

GPG_TTY=$(tty)
export GPG_TTY

Leave a Reply

Your email address will not be published. Required fields are marked *