Shared server guidance · Question & answer

How do I choose a particular private key when connecting?

Pass the private-key filename to -i and use IdentitiesOnly=yes to avoid offering unrelated agent keys. The corresponding public key must already be authorised for the remote account. Selecting a key cannot grant privileges that the account does not have.

BeginnerWindows 11 with Microsoft OpenSSH Client; Windows PowerShell 5.1 or PowerShell 7 as labelledLinux VPS and dedicated servers where a remote Linux command is shown
Go to the answer

Instructions

1. Identify the matching public-key fingerprint

Inspect the public file beside the private key. Keep private-key contents out of screenshots, chat and server uploads.

Local Windows PowerShell
ssh-keygen -lf "$env:USERPROFILE\.ssh\server_ed25519.pub"

Compare this fingerprint with the key enrolled for the intended server account.

2. Connect with the explicit identity

Use the filename without .pub as the private identity. Quote the full path so spaces remain one argument.

Local Windows PowerShell
ssh -o IdentitiesOnly=yes -i "$env:USERPROFILE\.ssh\server_ed25519" adminuser@203.0.113.10

The options select the local private key and limit offered identities. An encrypted key can still prompt for its passphrase.

3. Confirm the account and keep the key local

After login, check whoami. A successful key exchange proves acceptance for this account; it does not prove the same key is authorised for another username or another server.

Check the result

  • The selected public-key fingerprint matches the enrolled key.
  • SSH opens the intended account without offering a series of unrelated identities.

Troubleshooting

Identity file is not accessible
Check the exact local path and file access permissions.
The selected key is rejected
Confirm the remote username and enrolled public key. Repeatedly generating new keys will not repair a mismatched account.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.