Affected versions: 24.04

📖 ~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 SSH attempts fail with ‘Connection refused’.

Illustrative mockup for ubuntu-24-04-lts — post-186-2
Illustrative mockup – Progressive Robot — Illustrative mockup — Progressive Robot

Environment & Reproduction

Common on fresh server installs where OpenSSH server was not enabled.

Illustrative mockup for ubuntu-24-04-lts — post-186-2
Illustrative mockup – Progressive Robot — Illustrative mockup — Progressive Robot

Root Cause Analysis

sshd is stopped, missing, or blocked by firewall policy.

Illustrative mockup for ubuntu-24-04-lts — post-186-2
Illustrative mockup – Progressive Robot — Illustrative mockup — Progressive Robot

Quick Triage

Check sudo systemctl status ssh and sudo ss -tulpn | grep :22.

Illustrative mockup for ubuntu-24-04-lts — post-186-2
Illustrative mockup – Progressive Robot — Illustrative mockup — Progressive Robot

Step-by-Step Diagnosis

Validate config syntax with sudo sshd -t and inspect logs with journalctl -u ssh -n 50.

Illustrative mockup for ubuntu-24-04-lts — post-186-1
Illustrative mockup – Progressive Robot — Illustrative mockup — Progressive Robot

Solution – Primary Fix

Install and start service: sudo apt install -y openssh-server && sudo systemctl enable –now ssh && sudo ufw allow OpenSSH.

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-24-04-lts — post-186-2
Illustrative mockup – Progressive Robot — Illustrative mockup — Progressive Robot

Solution – Alternative Approaches

Temporarily allow port 22 using sudo ufw allow 22/tcp if profile names are unavailable.

Illustrative mockup for ubuntu-24-04-lts — post-186-2
Illustrative mockup – Progressive Robot — Illustrative mockup — Progressive Robot

Verification & Acceptance Criteria

ssh user@host connects and key authentication succeeds.

Illustrative mockup for ubuntu-24-04-lts — post-186-2
Illustrative mockup – Progressive Robot — Illustrative mockup — Progressive Robot

Rollback Plan

Disable service with sudo systemctl disable –now ssh if emergency rollback is needed.

Illustrative mockup for ubuntu-24-04-lts — post-186-2
Illustrative mockup – Progressive Robot — Illustrative mockup — Progressive Robot

Prevention & Hardening

Use key-based login and disable password authentication after validation.

Illustrative mockup for ubuntu-24-04-lts — post-186-2
Illustrative mockup – Progressive Robot — Illustrative mockup — Progressive Robot

Related: ‘Connection timed out’ when network routing differs.

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

View all Ubuntu 24.04 LTS tutorials on the Tutorials Hub →

Browse all common problems & solutions on the Tutorials Hub.

Illustrative mockup for ubuntu-24-04-lts — post-186-2
Illustrative mockup – Progressive Robot — Illustrative mockup — Progressive Robot

References & Further Reading

OpenSSH server hardening guides and Ubuntu server docs.

Illustrative mockup for ubuntu-24-04-lts — post-186-2
Illustrative mockup – Progressive Robot — Illustrative mockup — Progressive Robot

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.