ssh
by default will check for certain identity files, for example ~/.ssh/id_rsa
. However, you can specify alternative identity files with -i
. See man ssh
for details.
ssh-agent helps manage identity files:
From man ssh-agent
:
Multiple identities may be stored in ssh-agent concurrently and ssh(1)
will automatically use them if present.
One benefit of using ssh-agent is that if your private key is password-protected (recommended), you can unlock it once when adding it to your ssh-agent and you won't need to re-enter the password every time you use it.
Other benefits include agent forwarding. See man ssh
for details.