Q: A critical web server is unresponsive, butping still works. SSH connection is refused. What could be the issue and how would you resolve it?
If ping works but ssh is refused, the server is up (network layer is fine) but the SSH daemon (sshd) is either down, rejecting connection...
🛠️ Production Runbook & Step-by-Step Resolution
Initial Diagnostics & Root Cause Analysis
If ping works but ssh is refused, the server is up (network layer is fine) but the SSH daemon (sshd) is either down, rejecting connections (e.g., max connections reached, TCP wrappers), or a local firewall is blocking port 22.
- Is
sshdrunning?systemctl status sshd - Check logs:
journalctl -u sshdor/var/log/auth.log - Check firewall rules:
iptables -Lorufw status
Remediation & Permanent Safeguards
To resolve: If physical or console access (like AWS Systems Manager or a hypervisor console) is available, I would log in and check: If it's an Out Of Memory (OOM) issue, sshd might have been killed by the OOM killer. I'd reboot the instance via the cloud provider console if no other access is possible to restore service, then investigate /var/log/messages after recovery.
- Is sshd running? systemctl status sshd
- Check logs: journalctl -u sshd or /var/log/auth.log
- Check firewall rules: iptables -L or ufw status