Failing to SSH in is the most common beginner snag. Don't rush to reinstall — work this checklist from outside in, and most cases resolve in minutes.

1. First, Identify Where It Fails

  • Connection timed out: can't reach it at all → network/port/firewall issue.
  • Connection refused: you reach the machine but SSH isn't listening → service down or wrong port.
  • Permission denied: connected but login fails → password/key/username issue.

2. Network and Port (for timeouts)

  • ping the IP to check if it's online (some datacenters block ping, so treat as a hint).
  • Confirm the SSH port (default 22, sometimes changed): connect with ssh -p PORT user@IP.
  • Is your local network/ISP blocking 22? Try another network or ask the vendor.

3. Firewall (the usual culprit)

  • Cloud firewall: many forget to allow the SSH port in the console's security group — the number-one cause.
  • System firewall: ufw / iptables blocking 22. Beginners often deny everything when enabling ufw and forget to allow 22, locking themselves out.

4. Authentication (for Permission denied)

  • Right username? root, or ubuntu / admin? Cloud vendors use different defaults.
  • Key login: the private key needs chmod 600, and its public key must be in the server's ~/.ssh/authorized_keys.
  • If the server disabled password login (PasswordAuthentication no), only keys will work.

5. Last-Resort Fallbacks

  • Use the cloud vendor's web console / VNC to get in directly, bypassing SSH to fix config or open the port.
  • Temporarily banned by fail2ban after repeated failures? Wait a few minutes or try another IP.
  • As a last resort, roll back a snapshot or reset (back up data first).