Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
I am having the same issues with KDE 4.10.1 Did you find another solution other than the one provided by enzotib below? I am reading these articles which may be related and – ccamara Mar 27 '13 at 8:33
up vote 4 down vote accepted

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:

ssh() {
    if ! ssh-add -l &>/dev/null; then
        ssh-add </dev/null &>/dev/null
    command ssh "$@"

i.e., if the agent has no key stored already (! ssh-add -l), then call it with input from /dev/null: this is to convince ssh-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.

share|improve this answer
Thanks - it looks like an interesting workaround and i'll give it a try just to see how it operates, but I rather have a more system-level solution. – Guss Nov 28 '11 at 11:57
I didn't get an answer of the type that I wanted, but as no other answer appears to be forthcoming and this workaround appears to work very nicely for my needs - I'll accept it. Thanks @enzotib – Guss Dec 16 '11 at 10:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.