Force password prompt to work in terminal instead of GUI
I am not sure what’s causing this, but it’s mildly frustrating.
sshing into my machine (Ubuntu 21.10) and invoking a
tilix session to my client machine. I trying to run an app (from within
tilix remotely), I need to run which should prompt for a password. The machine is running a GUI (
kded5), but that shouldn’t matter. I’m ssh’ed into the machine. This app prompts for password in the GUI instead of in the terminal.
I’ve tried unsetting
DISPLAY. I’ve tried setting
SSH_ASKPASS_REQUIRE=never (used them separately and together). I’ve tried various other things but to no avail. Since I’m using
kded5, the system
alternatives is set to
/usr/bin/kshaskpass. I haven’t tried setting it to something else:
at 14:25:06 ❯ update-alternatives --display ssh-askpass ssh-askpass - auto mode link best version is /usr/bin/ksshaskpass link currently points to /usr/bin/ksshaskpass link ssh-askpass is /usr/bin/ssh-askpass slave ssh-askpass.1.gz is /usr/share/man/man1/ssh-askpass.1.gz /usr/bin/ksshaskpass - priority 35 slave ssh-askpass.1.gz: /usr/share/man/man1/ksshaskpass.1.gz /usr/lib/ssh/x11-ssh-askpass - priority 10 slave ssh-askpass.1.gz: /usr/share/man/man1/x11-ssh-askpass.1x.gz
To be clear, what I want is simple…
if I’m the terminal to the machine, use the terminal to prompt for passwords. If I’m in the GUI, use the GUI or at least point me in the direction on how to temporarily use terminal prompting if so desired.
Well it’s not perfect, but I had to settle for the hints here…
The problem was mainly stemming from my signing code to github, which when I attempted to commit code, a dialog box was being created in my GUI, but I couldn’t or wasn’t seeing that from my Xserver. It was popping it up off-screen. So I needed to force console password entry. I finally found this hinting that
gpg-agent was the culprit for asking for the password. So, I tweaked my
$HOME/.gnupg/gpg-agent.conf, which I had to create as it did not exist, yet. In the link, the option is there to use
pinentry-curses, which I already have installed. Finally, issuing the command
gpg-connect-agent reloadagent /bye and re-committing my code confirmed my issue was fixed. I hope this helps someone else. It’s not perfect, but it gets me what I was desiring.