How do I add an SSH key to my Smart VPS?

An SSH key lets you log in without typing a password, and it's much harder to guess than one. You add the public half to the portal once, then tell your VPS to use it.

What this does

There are two steps, and both are needed. First you save your public key on your portal account. Then you apply it to a VPS. Saving a key doesn't change any server by itself, so it's safe to do whenever. Applying it to a VPS reboots that VPS.

A key is a pair of files. The public key ends in .pub and is safe to share: it's the one you paste into the portal. The private key has no extension and never leaves your computer. If you ever paste it anywhere, treat it as lost and make a new pair.

Steps

If you already have a key pair, skip to step 3. You'll need one line from the .pub file.

  1. On your computer, open a terminal. Windows 10 and later have the same ssh-keygen in PowerShell.
  2. Make a key with ssh-keygen -t ed25519. Press Enter to accept the default location, and set a passphrase when asked. The passphrase protects the key if your laptop is lost.
  3. Show the public key with cat ~/.ssh/id_ed25519.pub. It's one line starting ssh-ed25519. Copy the whole line.
  4. Log in to the portal at https://noc.versaweb.com.
  5. In the left menu, click Security, then the SSH Keys tab.
  6. Click Add new SSH key, the green button at the top right.
  7. Type a Name you'll recognise, like My laptop, and paste the line from step 3 into the key box.
  8. Click Submit. Your key appears in the list with a fingerprint.
  9. Go to Services, then Smart VPS Servers, then click your VPS. You land on the Overview tab.
  10. Find the SSH Keys row. The small + beside the label brings you back to step 5 if you need another key. Click the wrench beside your key's name (its tooltip says Reset SSH Keys).
  11. In the dialog, pick your key in the SSH Keys box. The dialog warns that this operation will reboot your server, so save any unsaved work first.
  12. Click Submit. The Overview shows Server is performing task for a minute or two while the VPS restarts.
  13. When the status says ON again, connect with ssh root@YOUR.IP.ADDRESS. SSH offers your key automatically, and asks for your passphrase if you set one.

How to check it worked

  • The login in step 13 goes through without asking for the server's root password. If you set a passphrase, it asks for that instead.
  • The Overview now lists your key's name next to SSH Keys.

If it didn't work

  • The wrench isn't on the Overview. It only appears once your account has at least one saved key. Add one under Security > SSH Keys first.
  • The portal says the key is invalid. Paste the public key: a single line that starts with ssh-ed25519 or ssh-rsa. A file that begins -----BEGIN is your private key, so don't paste it anywhere.
  • SSH still asks for a password. Give the VPS a minute to finish restarting, then try again. If you have several keys, point SSH at the right one with ssh -i ~/.ssh/id_ed25519 root@YOUR.IP.ADDRESS.
  • SSH warns that the host identification has changed. That can happen after a restart or rebuild. Remove the old entry with ssh-keygen -R YOUR.IP.ADDRESS and connect again.
  • You're locked out. Open the Serial console from the Overview page and log in with the root password. See How do I open the Serial console or VNC Console for my Smart VPS? and I can't connect to my Smart VPS over SSH. How do I get back in?.
  • Still stuck? Open a ticket under Technical Support with your IP address and the key's name. Never include the private key.

Related articles


Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 0