π ~1 min read
Table of contents
Symptom & Impact
SSH service remains inactive, preventing remote administration.
Environment & Reproduction
Typically occurs after editing sshd_config or include files.
sudo systemctl status ssh --no-pager
Root Cause Analysis
Invalid directive or syntax in SSH daemon configuration prevents startup.
Quick Triage
Run config validation and inspect service logs.
sudo sshd -t
sudo journalctl -u ssh -n 80 --no-pager
Step-by-Step Diagnosis
Find problematic line and conflicting include directives.
sudo sshd -T | head
sudo grep -R '^[^#]' /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf 2>/dev/null

Solution – Primary Fix
Correct invalid directives and restart ssh service.
Still having issues? Our Server Management team can diagnose and resolve this for you. Get in touch for a free consultation.
sudoedit /etc/ssh/sshd_config
sudo sshd -t
sudo systemctl restart ssh

Solution – Alternative Approaches
Temporarily revert to packaged default config and reapply approved hardening incrementally.
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bad
sudo cp /usr/share/openssh/sshd_config /etc/ssh/sshd_config
Verification & Acceptance Criteria
sshd is active and accepts authenticated connections.
systemctl is-active ssh
ssh -o ConnectTimeout=5 localhost true
Rollback Plan
Restore previous known-good sshd configuration if login regressions occur.
sudo cp /etc/ssh/sshd_config.bad /etc/ssh/sshd_config
sudo systemctl restart ssh
Prevention & Hardening
Require pre-restart sshd -t validation in change procedures.
sudo sshd -t
Related Errors & Cross-Refs
Related to bad configuration option and terminating, 1 bad configuration options.
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 OpenSSH server configuration and hardening documentation.
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.