📖 ~1 min read
Table of contents
Symptom & Impact
Remote SSH sessions fail immediately after ufw enable, causing management outage risk.
Environment & Reproduction
Ubuntu 24.04 LTS server where ufw was enabled before allowing OpenSSH.
Root Cause Analysis
Default deny incoming policy blocks TCP port 22 without an explicit allow rule.
Quick Triage
Use console access to run ufw status numbered and inspect current inbound rules.
Step-by-Step Diagnosis
Confirm sshd is healthy with systemctl status ssh and verify firewall chain counters for dropped packets.

Solution – Primary Fix
Add ufw allow OpenSSH or ufw allow 22/tcp, then reload UFW and retest remote login.
Still having issues? Our IT Consulting team can diagnose and resolve this for you. Get in touch for a free consultation.

Solution – Alternative Approaches
Use source-restricted rules such as ufw allow from trusted subnet to any port 22 proto tcp.
Verification & Acceptance Criteria
SSH login succeeds from authorized endpoints while default deny policy remains enforced.
Rollback Plan
Temporarily run ufw disable only from console if immediate remote recovery is required.
Prevention & Hardening
Apply firewall change order policy: allow management channels before enabling deny defaults.
Related Errors & Cross-Refs
nftables conflicts, wrong ListenAddress in sshd_config, and cloud ACL blocks can appear similar.
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
UFW documentation and Ubuntu OpenSSH hardening guides.
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.