Troubleshooting

Fix SSH "connection refused", "timed out" and "permission denied"

Work out what each SSH error means, test the port from your computer, and use the control panel's browser console to fix the firewall, the SSH service or key permissions.

IntermediateLinux server3 min read

SSH errors look alike, but each points to a different cause. Read the exact message first, then follow the matching section.

What the error means

  • Connection timed out: your packets get no answer. The server is off, the IP or port is wrong, or a firewall silently drops the traffic.
  • Connection refused: the server answered, but nothing listens on that port. SSH is stopped or runs on another port.
  • Permission denied (publickey,password): SSH works; the server rejected your user, password or key.
  • REMOTE HOST IDENTIFICATION HAS CHANGED: the server's key differs from the one your computer saved.

1. Check the basics

  1. In the client area, open Services and confirm the server is running. Start it if it is stopped.
  2. Compare the IP address with the one on your service page, character by character.
  3. If you changed the SSH port, connect with ssh -p <port>.
  4. Try another network, such as a phone hotspot. Some office, school and public Wi-Fi networks block outgoing SSH.

2. Test the port from your computer

On Windows PowerShell:

PowerShell
Test-NetConnection 203.0.113.25 -Port 22

On macOS or Linux:

Bash
nc -vz 203.0.113.25 22

TcpTestSucceeded: True or succeeded means the port is reachable and the problem is the login itself (go to section 4).

3. Fix it from the browser console

The browser console works without SSH. Click Open Control Panel on your service page, open the console and log in as root. Then check, in order:

Bash
systemctl status ssh --no-pager      # Ubuntu / Debian (use sshd on AlmaLinux / Rocky)
sudo sshd -t
sudo ss -tlnp | grep -i ssh
  • If SSH is stopped, sshd -t tells you which config line is broken. Fix it, then systemctl restart ssh (or sshd).
  • If ss shows a port other than the one you used, connect to that port.

Then check the firewall and Fail2ban:

Bash
sudo ufw status                       # Ubuntu / Debian
sudo firewall-cmd --list-all          # AlmaLinux / Rocky
sudo fail2ban-client status sshd      # if Fail2ban is installed

Allow your SSH port if it is missing, and unban your IP with sudo fail2ban-client set sshd unbanip <your-ip>.

Tip: A completely full disk can stop services from starting. If df -h shows 100% on /, see Free up disk space on Linux.

4. Permission denied

Run SSH in verbose mode and look at which keys are offered and rejected:

Bash
ssh -v alex@203.0.113.25
  • Use the right user: root on a fresh server, or the user you created.
  • Point at the right key: ssh -i ~/.ssh/id_ed25519 alex@203.0.113.25.
  • On the server, fix key permissions for that user:
Bash
chmod 700 /home/alex/.ssh
chmod 600 /home/alex/.ssh/authorized_keys
chown -R alex:alex /home/alex/.ssh

If password logins are disabled and you lost your key, add a new public key to authorized_keys from the browser console.

5. Host key changed

After an OS reinstall this is expected. Remove the saved key and reconnect:

Bash
ssh-keygen -R 203.0.113.25

Warning: If you did not reinstall or change anything, do not accept the new key. Open a support ticket first.

Still stuck?

Do not reinstall the server just to regain access; a reinstall erases everything. Open a support ticket with the exact error, the time you tried, and the output of ssh -vvv (it contains no passwords). Never paste a password or private key into a ticket.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.