I have a private key with a passphrase

And I have 2 computers running Ubuntu 14.04

  • On the first I added the key using ssh-add ~/.ssh/id_rsa It asked me the passphrase, and it was added permanently.

  • On the other when I add a key using ssh-add ~/.ssh/id_rsa it is asking me the passphrase and adding it temporarily (it will be removed at the next reboot).

But all others ssh keys without passphrase are added automatically.

I have tried the solutions explained here: https://stackoverflow.com/questions/3466626/add-private-key-permanently-with-ssh-add-on-ubuntu

But it doesn't work. And I really don't see how it could work (despite the positive feedbacks).

I don't see how just defining our SSH key as a "IdentityFile" in the SSH config files would make it automatically add the SSH keys with passphrase. It would mean that when I do a ssh-add ~/.ssh/id_rsa the system is storing the passphrase somewhere, but using it only if I add "IdentityFile" in the config. And for ssh key without passphrase it doesn't need any "IdentityFile".

Does someone knows how ssh-add work on this? How can the ssh-add behaviour can be so undeterministic?

2 Answers 2


There is no way to add a key with passphrase permanently. The encrypted key is stored in the memory of ssh-agent, which is not persistent across the reboots.

The keys in default location or the keys mentioned in ~/.ssh/config (without passphrase) do not need to be added to the agent. The ssh will pick them up automatically.

  • Ok, thanks but what about the keys (with passphrase) that seems to be added permanently to my first computer? Because I am rebooting it and the SSH keys are there and I can use them to connect
    – vemonet
    Mar 4, 2016 at 23:58
  • You are using probably gnome-keyring, which might do something like that.
    – Jakuje
    Mar 5, 2016 at 9:03
  • Linux Mint XFCE 19.3: I created a new RSA key with seahorse.
    – Phil
    Jun 15, 2020 at 9:41

I figured out what was the problem. It seems like it is gnome-keyring and seahorse that are adding it ti the ssh-agent

And seahorse need the public key (.pub) to be in .ssh (next to the private one) in order to automatically add it

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .