Permission Denied (publickey)

After ordering your Linux VPS at hstProv, you might encounter a Permission denied (publickey) error when trying to connect via SSH. This happens when the VPS doesn’t recognize your SSH key or you didn’t use a key to log in. To prevent brute-force attacks on the root/user account, most Linux VPS images are configured to allow only SSH key–based logins.

To gain access, either add your SSH key to the VPS (recommended) or temporarily enable password login. Using SSH keys is strongly advised; once configured, they allow secure, passwordless logins.


Method 1: Create and Add an SSH Key (Recommended)

Depending on your operating system, the method to generate an SSH key differs. Below are the procedures for the most common operating systems. Programs like Termius have a vault in which SSH keys can be generated. If you already have a key (e.g., id_ed25519.pub or id_rsa.pub), you can reuse it.

Windows (PowerShell)

ssh-keygen -t ed25519
# Press Enter for all prompts (or set a passphrase if you want extra protection)
# Your public key will be at:
# C:\Users\<YourUser>\.ssh\id_ed25519.pub

macOS / Linux (Terminal)

ssh-keygen -t ed25519
# Press Enter for all prompts (or set a passphrase if you want extra protection)
# Your public key will be at: ~/.ssh/id_ed25519.pub

Add your public key in the hstProv portal

  1. Log in to the Client Area (hstProv billing).
  2. Go to Services → Your Linux VPS.
  3. In the Information block (under power controls), click the pencil (edit) icon.
  4. Paste your public key (the *.pub file contents) into SSH Public Key and save.
  5. Reboot the VPS.

Once rebooted, connect with:

ssh <YOUR_USERNAME>@<YOUR_IPV4>

The IPv4 can be found in the client portal once the VPS has been delivered. The username was entered during the order process.


Method 2: Disable SSH Key Requirement (Enable Password Login)

If you prefer to log in with a password instead of a key, you can enable password-based authentication via the noVNC console in the control panel of the VPS.

  1. Go to Services → Your Linux VPS → Open noVNC console.
  2. Log in with the username/password you set during purchase.

The next steps differ per chosen Linux distribution.

Ubuntu / Debian

sudo su
# Enter your password if asked
sed -i 's/^KbdInteractiveAuthentication no/KbdInteractiveAuthentication yes/' /etc/ssh/sshd_config
systemctl restart ssh

CentOS / AlmaLinux / Rocky / Fedora / openSUSE

sudo su
# Enter your password if asked
sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/^#\?UsePAM.*/UsePAM yes/' /etc/ssh/sshd_config
systemctl restart sshd || systemctl restart ssh

Once the SSH service has restarted, connect with:

ssh <YOUR_USERNAME>@<YOUR_IPV4>
  • 0 Users Found This Useful
Was this answer helpful?