📖 ~1 min read
Table of contents
Symptom & Impact
Remote SSH attempts fail with ‘Connection refused’.

Environment & Reproduction
Common on fresh server installs where OpenSSH server was not enabled.

Root Cause Analysis
sshd is stopped, missing, or blocked by firewall policy.

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

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

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.

Solution – Alternative Approaches
Temporarily allow port 22 using sudo ufw allow 22/tcp if profile names are unavailable.

Verification & Acceptance Criteria
ssh user@host connects and key authentication succeeds.

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

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

Related Errors & Cross-Refs
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.

References & Further Reading
OpenSSH server hardening guides and Ubuntu server 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.