Cannot Connect via SSH — How to Enable SSH and Allow Root Login on Your VPS

This article covers the most common reasons you cannot connect to your VPS via SSH and walks you through fixing each one. If you are on a freshly provisioned VPS and have never connected via SSH before, start from Step 1.

Your VPS is always accessible through the NoVNC / Serial Console in the ServerSpan control panel, regardless of SSH status. Use it to run the commands below.


Quick-Reference: Commands by OS Family

Operating System Install SSH Enable & Start Restart
Debian / Ubuntu apt install openssh-server -y (automatic on install) systemctl restart ssh
Rocky / AlmaLinux / RHEL / Fedora dnf install openssh-server -y systemctl enable --now sshd systemctl restart sshd
openSUSE / SLES zypper install openssh-server -y systemctl enable --now sshd systemctl restart sshd
Arch / Manjaro pacman -Sy openssh systemctl enable --now sshd systemctl restart sshd
Alpine Linux apk add openssh-server rc-update add sshd && rc-service sshd start rc-service sshd restart
FreeBSD (pre-installed) sysrc sshd_enable="YES" && service sshd start service sshd restart
OpenBSD (pre-installed) rcctl enable sshd && rcctl start sshd rcctl restart sshd
LXC without systemd same as distro above service ssh start service ssh restart

Step 1 — Set a Root Password

In the NoVNC console, run:

passwd root

Type the new password twice and press Enter. Nothing appears on screen while typing — this is normal.

Step 2 — Allow Root Login with Password

Open the SSH configuration file:

nano /etc/ssh/sshd_config

Find and set these two lines (remove the leading # if present):

PermitRootLogin yes
PasswordAuthentication yes

Save with Ctrl+XYEnter.

Ubuntu 22.04 / 24.04 only — also check the override file:

nano /etc/ssh/sshd_config.d/50-cloud-init.conf

If it contains PasswordAuthentication no, change it to yes and save.

Restart SSH (use the correct command from the table above), then verify the active config:

sshd -T | grep -E "permitrootlogin|passwordauthentication"

Both lines must show yes. If not, a config override is still active — check all files under /etc/ssh/sshd_config.d/.

Step 3 — Connect with PuTTY (Windows)

  1. Download PuTTY from putty.org
  2. Enter your VPS IP in Host Name, Port 22, Connection type SSH
  3. Click Open → Accept the host key → Login as root
  4. Type your password (nothing shows — this is normal) and press Enter

Step 3 — Connect from Linux / macOS

ssh root@YOUR_VPS_IP

Type yes to accept the fingerprint on first connection, then enter your password.


Troubleshooting

Error Cause Fix
Connection refused SSH not running or firewall blocking port 22 Start sshd (see table above). On Ubuntu: ufw allow 22/tcp && ufw reload. On RHEL: firewall-cmd --permanent --add-service=ssh && firewall-cmd --reload
Permission denied Wrong password, or PermitRootLogin / PasswordAuthentication still restricted Run sshd -T | grep -E "permitrootlogin|passwordauthentication" — both must show yes. Check override files in /etc/ssh/sshd_config.d/
Password field does nothing Normal terminal behavior — passwords are never shown Keep typing and press Enter
REMOTE HOST IDENTIFICATION HAS CHANGED OS reinstalled, old key cached locally Run ssh-keygen -R YOUR_VPS_IP on your local machine, then reconnect
SSH starts then crashes (Alpine / minimal LXC) Missing host keys Run ssh-keygen -A on the server, then start sshd again

For a full walkthrough with explanations for every OS family, see the complete guide:
How to Enable SSH on a VPS and Connect with PuTTY — Complete Guide

If you are still unable to connect after following these steps, open a support ticket and include the exact error message from PuTTY or your terminal.


Was this article helpful?

mood_bad Dislike 0
mood Like 1
visibility Views: 12