SSH: Permission Denied

01

Error: `Permission denied (publickey,password)`

This error indicates credentials were not accepted.

Possible causes and solutions

Wrong password: Verify you're using the correct password. Remember SSH passwords are case-sensitive.

Wrong user:

bash
# Try with root
ssh root@IP

# Or with the correct username
ssh ubuntu@IP
ssh debian@IP

Password authentication disabled: If the server is configured to accept only SSH keys, you can't login with password. Use the private key:

bash
ssh -i ~/.ssh/id_ed25519 root@IP
02

Error: `Connection refused`

SSH port is not reachable.

Verify if SSH service is active (from VNC Console in panel):

bash
systemctl status sshd
systemctl start sshd

Verify if firewall blocks SSH port:

bash
ufw status
iptables -L -n | grep 22

Verify SSH is listening on the right port:

bash
ss -tlnp | grep ssh
03

Error: `Connection timed out`

Server not responding on SSH port.

Try with correct port if it was changed:

bash
ssh -p NEW_PORT root@IP
  • Firewall blocking the port
  • SSH port was changed
  • Server is unreachable (see Server Unreachable)
04

Error: `Host key verification failed`

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

This happens when server was reinstalled or IP was reassigned. The host key changed and SSH alerts you for security.

Solution: delete the old key:

bash
ssh-keygen -R SERVER_IP

# If port is different from 22
ssh-keygen -R [SERVER_IP]:PORT
05

Error: `Too many authentication failures`

SSH client tried too many keys. Specify the correct one:

bash
ssh -o IdentitiesOnly=yes -i ~/.ssh/id_ed25519 root@IP
06

Error: `No route to host`

Network problem between your computer and the server. Check:

bash
ping SERVER_IP
traceroute SERVER_IP

If ping works but SSH doesn't, the problem is on port 22.

07

Don't remember password and don't have SSH keys

If you can't access in any way:

  • Use VNC Console from control panel
  • If VNC console doesn't work either, start Rescue Mode
  • Follow the guide: Reset Root Password
08

Advanced SSH debug

To see what happens during connection:

bash
ssh -vvv root@IP

The detailed output shows exactly where and why the connection fails.

DeluxHost, fondata nel 2023, offre soluzioni di hosting di alta qualità per diverse esigenze digitali. Forniamo hosting condiviso, VPS e server dedicati con sicurezza avanzata e datacenter globali.

© DeluxHost, Tutti i diritti riservati. | Partita IVA: IT17734661006
Tutti i sistemi operativi