SSH: Permission Denied
How to resolve common SSH access errors
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:
# Try with root
ssh root@IP
# Or with the correct username
ssh ubuntu@IP
ssh debian@IPPassword authentication disabled: If the server is configured to accept only SSH keys, you can't login with password. Use the private key:
ssh -i ~/.ssh/id_ed25519 root@IPError: Connection refused
SSH port is not reachable.
Verify if SSH service is active (from VNC Console in panel):
systemctl status sshd
systemctl start sshdVerify if firewall blocks SSH port:
ufw status
iptables -L -n | grep 22Verify SSH is listening on the right port:
ss -tlnp | grep sshError: Connection timed out
Server not responding on SSH port.
- Firewall blocking the port
- SSH port was changed
- Server is unreachable (see Server Unreachable)
Try with correct port if it was changed:
ssh -p NEW_PORT root@IPError: 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:
ssh-keygen -R SERVER_IP
# If port is different from 22
ssh-keygen -R [SERVER_IP]:PORTError: Too many authentication failures
SSH client tried too many keys. Specify the correct one:
ssh -o IdentitiesOnly=yes -i ~/.ssh/id_ed25519 root@IPError: No route to host
Network problem between your computer and the server. Check:
ping SERVER_IP
traceroute SERVER_IPIf ping works but SSH doesn't, the problem is on port 22.
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
Advanced SSH debug
To see what happens during connection:
ssh -vvv root@IPThe detailed output shows exactly where and why the connection fails.