Your first SSH login to a new VPS

You log in to a CheapVPS server with an SSH client and a key pair: the console installs your public key for root at creation, and the IPv4 address on the server page is all you need to connect. This guide covers Windows, macOS and Linux, a handy config file, and every error people usually hit in the first ten minutes.

What do you need before the first login?

Three things: an SSH client on your computer, a key pair, and the public half of that key saved in the console before the server is created. Every current operating system ships an OpenSSH client. On Windows 10 and 11 it is an optional feature that is installed by default on most machines; open PowerShell and type ssh -V to confirm. On macOS and Linux the same command works in Terminal.

If ssh -V prints a version such as OpenSSH_9.6p1, you are ready. If PowerShell says the command is unknown, open Settings, Apps, Optional features, and add OpenSSH Client. No extra software is needed after that.

Keep the server page open in another tab. It shows the IPv4 address, the IPv6 network, the image you picked and the power state. In this guide the server address is 203.0.113.10; replace it with yours.

How do you create a key pair that the server will accept?

Generate an ed25519 key: it is short, fast and accepted by every image we offer, from Ubuntu 24.04 to Rocky Linux 9. Run this once per computer:

ssh-keygen -t ed25519 -a 100 -f ~/.ssh/cheapvps -C "laptop-2026"

The -f option gives the key its own file name, so it does not overwrite a key you already use for Git or work. The -a 100 option makes the passphrase harder to brute force if the private file is ever stolen. Type a passphrase when asked; an empty one works but leaves the key unprotected on disk.

You now have two files: ~/.ssh/cheapvps (private, never share it) and ~/.ssh/cheapvps.pub (public, safe to paste anywhere). Print the public one with cat ~/.ssh/cheapvps.pub on macOS and Linux, or Get-Content $env:USERPROFILE\.ssh\cheapvps.pub in PowerShell. The whole output is a single line beginning with ssh-ed25519.

Very old software that rejects ed25519 is rare today. If you must, use ssh-keygen -t rsa -b 4096 instead; the steps that follow do not change.

Where does the public key go in the console?

Open SSH keys in the console, choose to add a key, give it a name you will recognise later (for example the laptop name) and paste the full line. Then, when you create a server, tick that key in the order form. At first boot the key is written to /root/.ssh/authorized_keys on the new server.

A key saved in the console after the server already exists is not pushed to that running server. You have two ways to add it: log in with a key that already works and append the new line yourself, or rebuild the server with the key selected, which also wipes the disk. For a fresh, empty server the rebuild is often the quickest fix.

If you ordered without any key, the console showed a root password once at creation. You can log in with that password and add keys by hand. Lost it? Use root password reset on the server page, which sets a new one while the server keeps running its current system.

How do you connect for the first time?

Point your client at the private key and the server address:

ssh -i ~/.ssh/cheapvps root@203.0.113.10

On the very first connection the client prints the server host key fingerprint and asks whether to trust it. Answer yes and the fingerprint is stored in ~/.ssh/known_hosts, so later connections are checked against it automatically. If you want to be strict, compare the fingerprint before typing yes: once you are in, run ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub on the server and confirm the SHA256 value matches what your client showed.

A successful login ends at a prompt such as root@vps-fra1:~#. Confirm where you are with three quick commands:

hostnamectl
ip -br addr
cat /etc/os-release

The first shows the host name and kernel, the second lists the IPv4 address and the IPv6 address from your /64, the third shows the exact release you installed.

Over IPv6 the address goes in plain form, no brackets needed for ssh itself: ssh -i ~/.ssh/cheapvps root@2001:db8::10. Use the address shown on the server page.

How do you save typing with an SSH config file?

Add a host entry to ~/.ssh/config and from then on ssh web1 is the whole command:

Host web1
    HostName 203.0.113.10
    User root
    IdentityFile ~/.ssh/cheapvps
    IdentitiesOnly yes
    ServerAliveInterval 30

IdentitiesOnly yes stops the client from offering every key in your agent, which avoids the "Too many authentication failures" message when you have many keys. ServerAliveInterval 30 sends a small keepalive so a quiet session does not drop behind home routers. The same alias works for scp, rsync and sftp: scp backup.tar.gz web1:/root/.

To avoid typing the passphrase every time, load the key into the agent once per session with ssh-add ~/.ssh/cheapvps. On macOS, add UseKeychain yes and AddKeysToAgent yes to the host entry to remember it across reboots.

What if you use PuTTY on Windows?

PuTTY reads its own key format, so convert the OpenSSH private key once with PuTTYgen: Conversions, Import key, choose cheapvps, then Save private key as cheapvps.ppk. In PuTTY, enter root@203.0.113.10 as the host, open Connection, SSH, Auth, Credentials and select the .ppk file, then save the session under a name.

If you generate the key in PuTTYgen instead, copy the text in the box labelled "Public key for pasting into OpenSSH authorized_keys file". That box holds the single-line format the console expects; the .pub file PuTTYgen saves uses a different layout and will be rejected.

How do you fix the common first-login errors?

Almost every failed first login is one of four messages. Add -v to the command to see which key the client offered and where it stopped.

  • Permission denied (publickey). The server did not find your public key. Check that you ticked the key when ordering, that you pass the matching private file with -i, and that you are logging in as root. On the server, cat /root/.ssh/authorized_keys must contain your line.
  • Connection timed out. Nothing answered on port 22. Confirm the server shows as running on the server page, check the IP for typos, and try from another network: some office and hotel networks block outgoing port 22.
  • Connection refused. The machine answered but nothing listens on port 22, which usually means the server is still booting or SSH was moved to another port.
  • A changed host key warning. Expected after a rebuild, because a fresh image creates new host keys while the IP stays the same. Remove the old entry with ssh-keygen -R 203.0.113.10 and connect again.

A server that was just created needs about a minute to finish its first boot. Wait, then retry before changing anything.

What should you do right after you are in?

Spend five minutes before installing anything. Update packages so you start from current security fixes: apt update && apt full-upgrade -y on Ubuntu and Debian, dnf upgrade --refresh -y on Rocky, Alma, CentOS Stream and Fedora. Set the time zone you think in with timedatectl set-timezone Europe/Berlin, so log times make sense. Give the machine a clear name with hostnamectl set-hostname web1, and rename it in the console too so both lists match.

Then follow the SSH hardening guide to create a sudo user and switch off password logins, and the firewall guide to close every port you do not use. Those two steps take about fifteen minutes and stop nearly all of the automated login attempts that reach any public IP within hours of it going online.

Questions about this guide

Can I log in from my phone?

Yes. Any SSH app for Android or iOS works. Generate a key inside the app, paste its public line into the console under SSH keys, and select it when you create or rebuild the server.

Is there a browser console if SSH stops working?

No, servers are reached over SSH only. Keep one working key on file, test changes in a second session, and remember that a reboot from the console clears firewall rules you have not saved yet.

Can several people use their own keys on one server?

Yes. Save each person's public key in the console and tick all of them at creation, or append extra lines to authorized_keys later. Better still, give each person their own user account with their key, as shown in the hardening guide.

Does the IP change when I rebuild the server?

No. A rebuild keeps the IPv4 address and the IPv6 network, but the host keys are new, so clear the old entry with ssh-keygen -R 203.0.113.10 before you reconnect.

Why does the root password reset not let me in?

If you already turned off password logins in the SSH settings, a new root password cannot be used over SSH. It still works for sudo and local tools, so keep a working key at all times.

Which plan is the cheapest to practise on?

The smallest Performance plan, P1 with 1 vCPU, 1 GB RAM, 20 GB NVMe, costs $3.95 a month, ordered as $47.40 for 12 months. It runs every image and is enough for learning SSH and Linux basics.