CONSIDERED INFRASTRUCTURE. INDIVIDUAL PROPOSALS.alonzofelixa@alonzo.cloud
HELP CENTER / Troubleshooting

Diagnose SSH connection and authentication errors

Identify the failing SSH stage before changing configuration, and stop immediately when the server identity cannot be verified.

By ALONZO & ALONZO, LLCPublished Updated

Applies to Authorized SSH access to an existing VPS; server-side service and journal examples assume Ubuntu.

Before you begin

  • The independently verified hostname, external SSH port, username, and expected host-key fingerprint.
  • A preserved working session or an independently verified authorized recovery route, if available.
  • Authority for server-side inspection; use sudo as shown, or omit it in an authorized root shell.

Capture one bounded connection attempt

Replace uppercase placeholders with verified values: SERVER_HOST, SSH_USER, the external numeric SSH_PORT, and your client-side private-key path KEY_FILE. From the client, make one diagnostic attempt:

ssh -vv -o ConnectTimeout=10 -o ConnectionAttempts=1 -p SSH_PORT -i "KEY_FILE" SSH_USER@SERVER_HOST

Read the final error and the stage immediately before it. Verbose output can reveal usernames, addresses, paths, key fingerprints, and environment details. Review and redact it before sharing. Do not paste private keys, passwords, or passphrases. Avoid repeated attempts that could trigger account or network protections.

Distinguish name, timeout, and refusal failures

A name-resolution error points first to the hostname or resolver path. A timeout means a response did not arrive in time; possible causes include routing, filtering, forwarding, or an unavailable machine. It does not establish that SSH credentials are wrong. A refused connection commonly means no listener accepted that endpoint, or a device actively rejected it.

Recheck the authorized connection record rather than trying nearby ports. Compare the external mapping with the actual guest listener through trusted access. If guest access is unavailable, use only an authorized recovery route that genuinely exists or ask the responsible administrator to inspect it. Do not scan networks or disable filtering to discover the endpoint.

Treat host-key changes as an identity problem

If SSH reports a changed host key, stop authentication and do not accept the replacement merely to continue troubleshooting. Independently verify whether the endpoint, forwarding rule, or operating-system installation changed. Obtain the complete expected fingerprint and algorithm from a trusted administrator or verified recovery access.

An authorized person can inspect the corresponding guest public host-key file with ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub when that is the algorithm in use. Only after identity has been established should the exact saved host-and-port entry be deliberately updated through your approved process. Never bypass host checking or blindly delete the known-hosts file.

Check account and key selection before changing permissions

Permission denied usually means the transport reached SSH but the offered authentication was not accepted. Verify the exact account name and that its approved public key was installed. An SSH agent may offer unrelated keys; retry once with -o IdentitiesOnly=yes and the intended -i path.

Using an existing trusted session as the affected account, inspect ~/.ssh and ~/.ssh/authorized_keys ownership and permissions. A private key belongs on the client, never in authorized_keys. Do not apply recursive permission changes to a home directory, unlock accounts without authorization, or enable password or root login as a shortcut.

Inspect the guest without restarting services

From an existing authorized Ubuntu session, collect focused evidence:

sudo ss -lntp
sudo sshd -t
sudo journalctl -u ssh --since "15 minutes ago" --no-pager -n 60

Match the actual listener to GUEST_SSH_PORT, not automatically to the client's SSH_PORT. NAT and external access-control rules must be checked separately. A silent sshd -t indicates a successful syntax check, not successful remote reachability. Review authentication logs near the recorded attempt. Socket activation and local service customization can affect which unit owns the listener; do not restart an assumed unit or edit its configuration without understanding the existing setup.

Retest one change and escalate with redacted evidence

After an authorized, understood correction, make one fresh connection using the same documented endpoint. Confirm the expected host identity and account. If administrative access is required, verify sudo in that new session while preserving the original connection. Never treat an existing connection surviving as proof that new connections work.

For escalation, supply UTC time, exact final error, client version, the failing stage, and a redacted explanation of external-to-guest port mapping. Include only relevant listener or journal excerpts, with account names, hostnames, addresses, and paths removed as appropriate. State what remains unverified instead of reporting a speculative cause as established fact.

Final checklist

  • The failure is classified as resolution, transport, identity, or authentication.
  • Changed host keys were independently verified before any saved entry was updated.
  • SSH_PORT and GUEST_SSH_PORT were not assumed to be the same.
  • A fresh authorized login works after correction, with sudo checked when required.
  • Escalation includes bounded, redacted evidence and no credentials or private keys.

Sources & further reading

YOUR NEXT STEP

Discuss your requirements.

For a VPS proposal, share your workload, preferred region and resource needs. Availability, specifications and terms are confirmed separately; an inquiry does not place an order or provision a server.

Start an inquiry