A client has several private keys and must connect to app.example.test using a specified key.
Which command is appropriate?
ssh -i identity_file selects the private key used for a connection.
Detailed explanation
ssh -k ~/.ssh/app_ed25519 trainee@app.example.testIncorrect. -k disables GSSAPI credential delegation; it does not select a key file.
Incorrect. -k disables GSSAPI credential delegation; it does not select a key file.
ssh -K ~/.ssh/app_ed25519 trainee@app.example.testIncorrect. -K is not the general option for specifying an SSH key file.
Incorrect. -K is not the general option for specifying an SSH key file.
ssh-keygen -i ~/.ssh/app_ed25519 trainee@app.example.testIncorrect. ssh-keygen -i converts an external key format and does not connect to a host.
Incorrect. ssh-keygen -i converts an external key format and does not connect to a host.
ssh -i ~/.ssh/app_ed25519 trainee@app.example.testCorrect. -i specifies the private key file for this connection.
Correct. -i specifies the private key file for this connection.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s\n' 'ssh -i ~/.ssh/app_ed25519 trainee@app.example.test'Expected result
ssh -i ~/.ssh/app_ed25519 trainee@app.example.testKey points
- ssh -i
- identity file
- Connection versus key generation
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
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.