📖 ~1 min read

Table of contents
  1. Symptom & Impact
  2. Environment & Reproduction
  3. Root Cause Analysis
  4. Quick Triage
  5. Step-by-Step Diagnosis
  6. Solution – Primary Fix
  7. Solution – Alternative Approaches
  8. Verification & Acceptance Criteria
  9. Rollback Plan
  10. Prevention & Hardening
  11. Related Errors & Cross-Refs
  12. References & Further Reading

Symptom & Impact

Remote login fails with connection refused or timeout, blocking administration and automation.

Environment & Reproduction

Ubuntu 20.04 host with OpenSSH server, potentially behind ufw or cloud security groups.

Root Cause Analysis

sshd stopped, port changed, firewall deny rule, or networking issue prevents TCP/22 reachability.

Quick Triage

From console run ‘systemctl status ssh’, ‘ss -ltnp | grep :22’, and ‘sudo ufw status verbose’.

Step-by-Step Diagnosis

Check ‘/etc/ssh/sshd_config’, validate with ‘sshd -t’, and inspect journalctl for auth or bind errors.

Illustrative mockup for ubuntu-20-04-lts — ubuntu2004-cp07-ssh-refused-diagnose.webp
SSH connectivity and daemon diagnostics — Illustrative mockup — Progressive Robot

Solution – Primary Fix

Enable/start ssh service, allow rule with ‘sudo ufw allow OpenSSH’, and reload daemon if config changed.

Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.

Illustrative mockup for ubuntu-20-04-lts — ubuntu2004-cp07-ssh-refused-fix.webp
Restoring sshd service and firewall rules — Illustrative mockup — Progressive Robot

Solution – Alternative Approaches

Use temporary alternate port and bastion host while remediating network path restrictions.

Verification & Acceptance Criteria

SSH handshake succeeds from approved source and key-based auth works without errors.

Rollback Plan

Revert sshd_config to backup and disable recent firewall policy changes if access worsens.

Prevention & Hardening

Use configuration management, keep console access, and monitor failed login plus sshd availability.

Permission denied (publickey), no route to host, and ufw route policy conflicts.

Related tutorial: View the step-by-step tutorial for Ubuntu 20.04 LTS.

View all Ubuntu 20.04 LTS tutorials on the Tutorials Hub →

Browse all common problems & solutions on the Tutorials Hub.

References & Further Reading

OpenSSH hardening guide, ufw application profiles, and Ubuntu server security docs.

Need Expert Help?

If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today — we respond within one business day.