Prerequisites
Before troubleshooting:
- Verify your server is powered on
- Check that SSH service is installed
- Confirm firewall rules allow port 22
What "Connection Refused" Means
This error indicates:
- Nothing is listening on the specified port (22 by default)
- The SSH service is not running
- A firewall is actively rejecting the connection
Fix 1: Ensure SSH Service is Running
Via VPS console (Hostxpeed control panel > Console), check SSH status:
sudo systemctl status sshdIf stopped, start it:
sudo systemctl start sshdEnable to auto-start on boot:
sudo systemctl enable sshdFix 2: Check SSH is Installed
Verify SSH package is installed:
which sshdIf not found, install it:
# Ubuntu/Debian
sudo apt install openssh-server -y
# CentOS/RHEL/Rocky
sudo yum install openssh-server -yFix 3: Verify SSH Port
Check if SSH is running on a custom port:
sudo netstat -tlnp | grep sshOr:
sudo ss -tlnp | grep sshIf running on port 2222 instead of 22, connect with:
ssh hxroot@YOUR_SERVER_IP -p 2222Fix 4: Firewall Blocking
Check if firewall is blocking port 22:
# For UFW (Ubuntu/Debian)
sudo ufw status
# For firewalld (CentOS/RHEL)
sudo firewall-cmd --list-allAllow SSH:
# UFW
sudo ufw allow 22/tcp
sudo ufw reload
# Firewalld
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reloadFix 5: Check /etc/ssh/sshd_config for ListenAddress
Ensure SSH is listening on correct interface:
sudo grep ListenAddress /etc/ssh/sshd_configShould show:
ListenAddress 0.0.0.0Or comment out the line entirely.
Fix 6: Out of Memory or Disk Space
Services may fail to start if server resources are exhausted:
# Check disk space
df -h
# Check memory
free -h
# Check inodes
df -iIf full, free up space or reboot.
💡 Tip: Use Hostxpeed's VNC/Console access from your control panel to troubleshoot when SSH is unavailable.