After enabling the firewall, SSH dies mid-session.
ufw enable applied a default-deny before the SSH allow rule existed.
ufw allow 22/tcp && ufw enableufw default deny incoming; ufw default allow outgoing; ufw allow 22/tcp# cloud SG must ALSO allow 22Allow SSH, verify with ufw status, then enable — always that order.
Spinning up a fresh box to reproduce or escape this error?
Managed cloud hostingNinjaOps publishes free engineering guides. Some outbound links are affiliate links: they cost you nothing and support the site.
Last reviewed 2026-10-02 · NinjaOps SEO grid · DevOps blog