An “SSH connection refused” error indicates that the connection reached the host, but no service accepted it. This runbook provides a structured, low-risk approach to identify and resolve the issue without locking yourself out.
Symptoms
-
SSH client returns connection refused
-
Server responds to ping, but SSH fails
-
Issue appeared after hardening or firewall changes
-
Console access still works
Environment
-
Linux servers (AlmaLinux, Rocky Linux, Ubuntu, Debian)
-
OpenSSH server
-
Tested on systemd-based distributions
Common Root Causes
-
sshd service stopped or failed
-
SSH listening on a non-standard port
-
Firewall blocking port 22 (or custom port)
-
SELinux denying sshd access
-
IP-based access restrictions
Fix Path (SAFE)
Step 1: Verify SSH Service Status
If stopped:
Step 2: Confirm Listening Port
Expected:
If a custom port is used, note it for firewall checks.
Step 3: Check Firewall Rules
firewalld
nftables / iptables
Step 4: SELinux Validation (If Enabled)
If enforcing:
Allow custom port if required:
Verification
Connection should succeed without errors.
Leave a Reply