This guide regards Linux systems, in particular XUbuntu 14.04.4.
When I sign files, I use gnupg2 by running gpg2 -ab FILE from the shell. Then it used to ask me for the password to access my private key to sign the file with.
I haven’t done this since a while and now I run into a problem: The said command pops up a GUI window named pinentry right from the console. I have a long random password so I use a password safe to store it. So I use to copy&paste the password.
But the pinentry window did take keystrokes but not copy&paste! But it let crash my whole X-window-system!
At last I found out that I can uninstall the package named pinentry-gtk2. This step caused that the package system installed another packet (this is the first time I see this) named pinentry-curses. Curses is a library to make GUI-like windows and control on the shell.
Now gpg2 -ab FILE launches the curses-version of pinentry. Now the controls to insert the password appear in the console window without affecting anything. I can copy&paste the password and got my file signed.
This is what I love on Linux: If one thing is broken you can use another thing which works.
However: You don’t let pop up a GUI window out from the shell, aren’t you?! There is curses for that!