Generate an Ed25519 key pair at ~/.ssh/id_ed25519 for an OpenSSH client user.
Set the comment to deploy@example.test.
Which command is appropriate?
ssh-keygen -t ed25519 -f PATH -C COMMENT creates a private key and PATH.pub at the requested location.
Detailed explanation
ssh-keygen -t rsa ~/.ssh/id_ed25519 -C deploy@example.testIncorrect. It selects RSA and does not use -f for the output path.
Incorrect. It selects RSA and does not use -f for the output path.
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -C deploy@example.testCorrect. It specifies Ed25519, the output path, and the comment.
Correct. It specifies Ed25519, the output path, and the comment.
ssh -keygen ed25519 ~/.ssh/id_ed25519Incorrect. The command and option syntax are invalid.
Incorrect. The command and option syntax are invalid.
ssh-keygen -f ed25519 -t ~/.ssh/id_ed25519Incorrect. The arguments for -f and -t are swapped.
Incorrect. The arguments for -f and -t are swapped.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' '-t ed25519=key type' '-f ~/.ssh/id_ed25519=private key path' '-C=comment'Expected result
-t ed25519=key type
-f ~/.ssh/id_ed25519=private key path
-C=commentKey points
- -t selects the key type
- -f selects the file
- Private and public pair
Notes
- Environment: OpenSSH ssh-keygen構文対応表
- 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.