One Unix based systems (Linux, BSD, Mac OS X), the default identity is stored in the directory $HOME/.ssh, in 2 files:
private key: $HOME/.ssh/id_rsa
public key: $HOME/.ssh/id_rsa.pub
When you use ssh
without option -i
, it uses the default private key to authenticate with remote system.
If you have another private key you want to use, for example $HOME/.ssh/deploy_key, you have to use ssh -i ~/.ssh/deploy_key ...
It is annoying. You can add the following lines in to your $HOME/.bash_profile :
ssh-add ~/.ssh/deploy_key
ssh-add ~/.ssh/id_rsa
So each time you use ssh
or git
or scp
(basically ssh
too), you don't have to use option -i
anymore.
You can add as many keys as you like in the file $HOME/.bash_profile.