Use ssh-agent so a generated key's passphrase need not be entered repeatedly.
Register an existing private key with the agent.
Which command is appropriate?
ssh-add registers a private key with ssh-agent so the agent can perform signing operations.
Detailed explanation
ssh-add ~/.ssh/id_ed25519Correct. ssh-add registers the private key.
ssh-keygen -AIncorrect. ssh-keygen -A generates host keys.
ssh-agent -a ~/.ssh/id_ed25519Incorrect. ssh-agent -a selects the agent socket.
ssh -A ~/.ssh/id_ed25519Incorrect. ssh -A enables agent forwarding for a connection.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s\n' 'ssh-add ~/.ssh/id_ed25519'Expected result
ssh-add ~/.ssh/id_ed25519Key points
- ssh-agent holds keys
- ssh-add registers
- Agent forwarding is separate
Notes
- Environment: OpenSSH clientのコマンド役割
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Host key
A server identity key used by SSH clients to detect a changed endpoint.
User key
A key pair used to authenticate a user to an SSH server.
Port forwarding
An SSH tunnel that carries traffic between a local, remote, or dynamic endpoint.