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

If I open a gnome terminal and connect to a server through SSH, I am asked for my passphrase by a text prompt in my terminal instead of a GUI, and, worse, this passphrase is not stored in memory for the duration of my Ubuntu session.

On the contrary, I use PGP keys with Enigmail in Thunderbird, and I have to enter my passphrases only once per session, using a GUI.

It seems I have 3 agents installed and running: seahorse-daemon, gpg-agent and ssh-agent, and they do not seem to play along nicely. I have a gnome-keyring running, too. I do not understand what each of these programs is supposed to do.

ssh-agent is run by my system with "/usr/bin/gpg-agent" as first command argument, and I do not understand what this means.

How can I set up which agent to use for ssh keys ?

share|improve this question

Run ssh-add in a terminal, and type in your passphrase when prompted. If this works, then every subsequent access to your ssh key should just work without any prompting, in all terminals and applications running in the same X session.

share|improve this answer

I do not use the GUI util in "settings" -> "passwords and keys"

I have installed keychain.

sudo apt-get install keychain

If you're running bash you need to add a few commands to your .bash_profile If you do not have a .bash_profile create one in your home folder. Add these lines:

### START-Keychain ###
# Let  re-use ssh-agent and/or gpg-agent between logins
/usr/bin/keychain $HOME/.ssh/id_dsa
source $HOME/.keychain/$HOSTNAME-sh
### End-Keychain ###

At the start of a work day I will login. When I open a terminal, I will be prompted once for my passphrase. For all other new terminals and connections I will not be asked for my passphrase again.

share|improve this answer

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.