I have a private key protected with a password to access a server via SSH.
I have 2 linux (ubuntu 10.04) machines and the behavior of ssh-add command is different in both of them.
In one machine, once I use "ssh-add .ssh/identity" and entered my password, the key was added permanently, i.e., every time I shutdown the computer and login again, the key is already added.
In the other one, I have to add the key every time I login.
As far as I remember, I did the same thing on both. The only difference is that the key was created on the one that is added permanently.
Does anyone know how to add it permanently to the other machine as well?
A solution would be to force the key files to be kept permanently, by adding them in your ~/.ssh/config file:
IdentityFile ~/.ssh/gitHubKey
IdentityFile ~/.ssh/id_rsa_buhlServer
If you want all users on the computer to use the key put these lines into /etc/ssh/ssh_config and the key in a folder accessible to all.
Additionally if you want to set the key specific to one host, you can do the following in your ~/.ssh/config :
Host github
HostName github.com
User git
IdentityFile ~/.ssh/githubKey
You ll need to clone with @github instead of @github.com, but this has the advantage that only this key will be tried.
http://stackoverflow.com/questions/3466626/add-private-key-permanently-with-ssh-add-on-ubuntu