I want to save an SSH key passphrase in gnome-keyring and then use it automatically when I need it.

How to do this?


To save the passphrase, use seahorse-ssh-askpass from package seahorse:

cd $HOME/.ssh /usr/lib/seahorse/seahorse-ssh-askpass my_key

Make sure that the public key is the filename of the private key plus .pub, in the example my_key.pub

To automatically use the key afterwards, see "Gnome Keyring dialog and SSH" and at first use, check "Automatically unlock this key whenever I'm logged in".

  • 4
    I used this command successfully with Ubuntu 10.04, it seems like it was not even required in Ubuntu 12.04, but with Ubuntu 14.04 I can't seem to be able to store my ssh key password. seahorse-ssh-askpass just prints the password I enter to stdout!!! – asoundmove Mar 20 '17 at 11:52
  • @asoundmove: I had the same experience on 16.04. You can use the seahorse prompt utility via ssh-add, however: SSH_ASKPASS=/usr/lib/seahorse/seahorse-ssh-askpass ssh-add /path/to/private/key </dev/null. Redirecting standard input is required to force the use of SSH_ASKPASS (graphical prompt). – zackse Nov 12 '18 at 22:26

If gnome-keyring-daemon is already running, you can use ssh-add to add your key to the service:

ssh-add /path/to/private/key

For example:

ssh-add ~/.ssh/id_rsa

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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