Sample Header Ad - 728x90

How to get pinentry-curses to start on the correct tty?

16 votes
2 answers
17938 views
I use gpg-agent for managing both PGP e SSH identities. The agent is started with a script like this gpg_agent_env="$XDG_CACHE_HOME/gpg-agent.env" export GPG_TTY="$(tty)" if ! ps -U "$USER" -o ucomm | grep -q gpg-agent; then eval "$({gpg-agent --daemon | tee $gpg_agent_env} 2> /dev/null)" else source "$gpg_agent_env" 2> /dev/null fi which is sourced whenever I run an interactive shell. Everything works fine with this setup but there is an issue. Let's say I: 1. open a terminal (launching the agent in background) and start working 2. after a while open a second terminal 3. do an action that requires entering a passphrase in the second terminal At this point gpg-agent will start pinentry-curses prompting a passphrase but it will do this in the first terminal which results in its output mixed with whatever was running (usually a text editor) with no way to resume the program or stop pinentry (it starts using 100% cpu and I have to kill it). I must be doing something wrong here. Anyone has experienced this? ### Update: I figured out this happens only for a prompt to unlock an SSH key, which looks like [this](https://lut.im/TfmmL5JMVe/CcXH06hdeCLyzsmH) , while prompts for PGP keys always open on the correct (i.e. current) tty.
Asked by Rnhmjoj (303 rep)
May 3, 2016, 06:57 PM
Last activity: May 5, 2022, 11:45 AM