How do I see the SSH settings that will actually be used?
Use ssh -G to print the effective client configuration after matching Host and Match rules. This is useful when a short alias unexpectedly chooses another username, port or key. It does not authenticate to the server.
Instructions
1. Inspect only the connection fields you need
Pass the same destination or alias you normally use. Avoid publishing a complete configuration dump because it may include internal hostnames and paths.
ssh -G example-server | Select-String -Pattern "^hostname |^user |^port |^identityfile |^identitiesonly "The filtered lines show the target and identity settings that the client resolves.
2. Compare an explicit option
Command-line options can override ordinary configuration values. Inspect the result before making a permanent edit.
ssh -G -p 2222 adminuser@vps.example.com | Select-String -Pattern "^hostname |^user |^port "This shows how the explicit user and port affect this invocation. It still does not open a connection.
3. Correct the narrow source of the mismatch
Inspect the relevant Host block and any included file. Keep a host-specific correction local to that entry, then repeat -G. Do not rewrite system-wide SSH configuration merely because one alias is wrong.
Check the result
- The effective values match the intended endpoint and account.
- A subsequent authenticated connection reaches the same server.
Troubleshooting
- The expected key is absent
- Check IdentityFile spelling, file ordering and which Windows profile supplies the configuration.
- The output differs from a colleague’s
- They may use another client version, profile, system configuration or included file.
Official references
Use the documentation for your installed version when a flag, service name or platform feature differs.
