Affected versions: Ubuntu 24.04 LTS

πŸ“– ~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 management becomes inaccessible after firewall changes.

Environment & Reproduction

Often occurs when default deny is enabled before allow rules.

sudo ufw enable

Root Cause Analysis

Rule ordering or missing source restrictions blocks TCP/22 unexpectedly.

Quick Triage

Check active policy and numbered rules.

sudo ufw status numbered

Step-by-Step Diagnosis

Confirm matching inbound rules and service status.

sudo ufw status verbose && sudo systemctl status ssh
Illustrative mockup for ubuntu-24-04-lts β€” ufw_ssh_block
Firewall rules denying SSH β€” Illustrative mockup β€” Progressive Robot

Solution – Primary Fix

Add explicit SSH allow rule and remove conflicting deny entries.

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

sudo ufw allow OpenSSH && sudo ufw delete 
Illustrative mockup for ubuntu-24-04-lts β€” ufw_allow_ssh_fix
Restoring SSH allow rule β€” Illustrative mockup β€” Progressive Robot

Solution – Alternative Approaches

Use out-of-band console to temporarily disable UFW for emergency access.

Verification & Acceptance Criteria

New SSH sessions connect successfully from approved source networks.

Rollback Plan

Revert to previous known-good UFW ruleset backup.

Prevention & Hardening

Apply firewall changes via scripted rule sets with prechecks.

Related to cloud security group denies and incorrect `sshd_config` ListenAddress.

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.

References & Further Reading

Ubuntu UFW and OpenSSH hardening references.

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.