Add ~/.ssh/id_ed25519 to a running ssh-agent so later SSH authentication can use it.
Which command is appropriate?
ssh-add PRIVATE_KEY registers an identity with the agent. A passphrase-protected key is unlocked during this operation and the agent performs later signing.
Detailed explanation
ssh-agent ~/.ssh/id_ed25519Incorrect. ssh-agent starts or manages an agent rather than adding a key this way.
Incorrect. ssh-agent starts or manages an agent rather than adding a key this way.
ssh-add ~/.ssh/id_ed25519Correct. It adds the specified private-key identity to the agent.
Correct. It adds the specified private-key identity to the agent.
ssh-keygen -A ~/.ssh/id_ed25519Incorrect. -A generates missing server host keys, not a user identity registration.
Incorrect. -A generates missing server host keys, not a user identity registration.
ssh -i ~/.ssh/id_ed25519 --addIncorrect. ssh has no --add option for agent registration.
Incorrect. ssh has no --add option for agent registration.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'ssh-add ~/.ssh/id_ed25519 -> add private identity to running agent'Expected result
ssh-add ~/.ssh/id_ed25519 -> add private identity to running agentKey points
- Use ssh-add
- Specify the private key
- The agent mediates secret-key use
Notes
- Environment: OpenSSH ssh-add構文対応表
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.