When using a GNOME desktop on Ubuntu, if I use OpenSSH client to connect to another computer (running from the gnome-terminal), I get a single graphic popup asking for my private key's pass-phrase. After that I no longer need to enter my pass-phrase as it is cached by the SSH agent.
Under KDE it doesn't work like that – when I start ssh from konsole, I get a text prompt for my pass-phrase every single time, even though ssh-agent is running.
If I run ssh-add from the terminal then I can enter my pass-phrase on the terminal and it will be stored by ssh-agent and I won't get any more pass-phrase prompts, while if I run ssh-add the KRunner graphical command line ("Run" dialog) then I get a graphical prompt with the same behavior. The problem is I have to remember running ssh-add every time I log in to the desktop.
How can I get ssh to behave under KDE, the same as it does on GNOME – the first time the pass-phrase is needed, pop up a graphical dialog and store the pass-phrase in the agent.
I've installed ksshaskpass, but that didn't change anything.
Best Answer
I don't know the internals so to explain why in GNOME it works and in KDE it doesn't, but I can suggest a solution.
Define a function like the following in your
~/.bashrc
:i.e., if the agent has no key stored already (
! ssh-add -l
), then call it with input from/dev/null
: this is to convincessh-add
has no terminal, and force to ask the password with a GUI window.You could set the
SSH_ASKPASS
environment variable to point to a different application to ask for the password.