SSH Connection Refused or Permission Denied? Fixes
An SSH connection refused error tells you the server was reached but nothing on that port accepted the connection. "Permission denied" tells you SSH did answer but turned the login down. Each has a handful of common causes.
"Permission denied"
- Reset the root password in the client area and give it a few minutes before trying again; see how to reset your VPS root password.
- Enter the password by typing it. Copying it from an email can bring hidden spaces along.
- Log in with the right username:
root, unless your deployment email gives a different one.
Still failing, and nothing on the server matters to you? Reinstalling it with a password you choose yourself is the quickest fix.
SSH connection refused or timed out
- Brand-new bare metal server? The install may not have finished. Give it time, then look at the console.
- Moved SSH to another port? Connect with
ssh -p PORT root@SERVER_IP. - Enabled a firewall? It may be blocking SSH.
Sign in through the VPS VNC console and run:
systemctl status ssh
sshd -T | grep -i '^port'
ufw status
Start the service with systemctl start ssh if it isn't running. If UFW (Ubuntu's built-in firewall) is on, open your SSH port, for example with ufw allow OpenSSH.
Keep in mind that Remote Desktop doesn't work with Linux servers. If Windows was what you wanted, reinstall the server using a Windows image.
Host key warnings
Following a reinstall, SSH reports that the remote host identification has changed. Clear the old key using ssh-keygen -R SERVER_IP, then reconnect. If the warning returns with a new key every time, raise a ticket.
Once you're in again, move to key-based logins; our guide to enabling and securing SSH on Ubuntu walks you through it. Every one of our VPS plans includes the web console for situations like this.
Was this article helpful?
Written by Julius · Product Manager