Connect to your VPS over SSH from any computer or phone

Open a terminal and run ssh root@203.0.113.10, with the user name and IP address of your own server in place of the sample ones. Windows 10 and 11, macOS and Linux all have the client; on a phone you need an app. The rest of this page covers keys, shortcuts and what to do when the connection fails.

Updated:

What you need before the first login

  • An address you can reach. This is the public IPv4 of the server, ordered with it for ₼10 a month. Only a VPS in a private network has no public address of its own: it needs a port forwarding rule on its router, or a VPN.
  • A user name. Use the one from your activation email or the credentials page of the panel. The examples below use root.
  • A password or a key. If you added an SSH public key when ordering, the matching private key on your computer replaces the password.
  • Port 22 open on your side. Some office and hotel networks block it. Mobile internet is a quick way to find out.

Windows Server is different: it is normally managed over RDP on port 3389, as described on the Windows VPS page.

Windows: Terminal, PowerShell or PuTTY

Open Windows Terminal (or PowerShell) and type:

ssh root@203.0.113.10

If the command is not found, install the optional OpenSSH client from an administrator PowerShell window:

Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

PuTTY still makes sense on older machines or if you like saved sessions in a window. Enter the IP in Host Name, keep port 22 and type SSH, give the session a name, press Save, then Open. PuTTY stores keys in its own .ppk format, which is created or converted in PuTTYgen.

macOS and Linux

The client is already there. Open Terminal and run the same command. If SSH listens on another port, add it with -p:

ssh -p 2222 root@203.0.113.10

First connection: check the fingerprint

On first contact SSH shows a fingerprint and asks whether to continue. To be certain that you are talking to your own machine, open the browser console in the panel, log in and print the real one:

ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub

If the two match, answer yes. Nothing appears on the screen while you type the password; that is normal.

Create a key and stop typing the password

A key pair is safer than any password you can remember. Run this on your own computer, on any system:

ssh-keygen -t ed25519 -C "work-laptop"

Accept the default path and set a passphrase. Now copy the public half (the file ending in .pub) to the server. On macOS and Linux:

ssh-copy-id -i ~/.ssh/id_ed25519.pub root@203.0.113.10

Windows has no ssh-copy-id, so in PowerShell use:

type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh root@203.0.113.10 "umask 077; mkdir -p ~/.ssh; tr -d '\r' >> ~/.ssh/authorized_keys"

In PuTTYgen choose EdDSA / Ed25519, press Generate, save the private key as .ppk and paste the text from the box at the top into ~/.ssh/authorized_keys on the server as one line. Then point PuTTY to the .ppk under Connection → SSH → Auth (Credentials in recent versions).

Open a second window and log in. If no server password is requested, the key works. Make a separate key for each device, so that a lost laptop means deleting one line. Password logins can be switched off next; that step belongs to securing the VPS.

Short names with ssh config

Create the file ~/.ssh/config (on Windows C:\Users\you\.ssh\config, with no extension):

Host shop
    HostName 203.0.113.10
    User root
    Port 22
    IdentityFile ~/.ssh/id_ed25519
    IdentitiesOnly yes
    ServerAliveInterval 60

From now on ssh shop is enough, and the same name works for copying files:

scp backup.tar.gz shop:/root/

ServerAliveInterval keeps idle sessions from being dropped by a router on the way.

Logging in from a phone

Termius runs on Android and iOS; ConnectBot and Termux are Android options. Generate a new key inside the app instead of sending your laptop key to yourself in a chat, add its public half to the server, and protect the app with the screen lock. A phone is fine for restarting a service or reading a log. For long jobs start tmux first, so the work survives a lost signal.

Error messages and what they mean

MessageLikely causeWhat to do
Connection refusedThe server answers, but nothing listens on this portCheck the port number; in the console run systemctl status ssh
Connection timed outWrong IP, stopped server, firewall, blocked network, private-network VPS without port forwardingCheck the panel, then try mobile internet
Permission denied (publickey)Wrong user or key, or password login disabledTry ssh -i with the right key; check the user name
Permission denied, please try againWrong password, or root may not use oneCompare with the panel; watch the keyboard layout
REMOTE HOST IDENTIFICATION HAS CHANGEDOS reinstalled, or the IP now belongs to another machineIf you expected that, run ssh-keygen -R 203.0.113.10
UNPROTECTED PRIVATE KEY FILEOther users can read your keyRun chmod 600 ~/.ssh/id_ed25519
Too many authentication failuresThe client offers many keys one after anotherAdd IdentitiesOnly yes to the config

If the host key changed and you did not reinstall anything, stop and compare the fingerprint in the console before going on. For everything else, ssh -v shop prints each step and shows where it stops. To test only the port:

# macOS, Linux
nc -vz 203.0.113.10 22
# Windows PowerShell
Test-NetConnection 203.0.113.10 -Port 22

When SSH does not work at all

The browser console in the Cloudraft panel does not depend on SSH, the firewall or the public address: it is the server's screen and keyboard. Use it to see whether the machine has booted, to restart the SSH service or to undo a firewall rule. Log in with a password there, because keys do not apply. These commands show the state of the service and the latest refusals:

sudo systemctl status ssh
sudo ss -tlnp | grep ssh
sudo journalctl -u ssh -n 30

Which distribution to choose, and what to run after logging in, is covered in Linux VPS.

Common questions about SSH access

What is the default SSH user name on a VPS?

It depends on the image: root, or a regular user with sudo rights. The correct one for your server is in the activation email and on the credentials page in the panel, next to the password.

Can I use SSH with a Windows Server VPS?

Windows Server 2019 and 2022 offer OpenSSH Server as an optional feature, but it has to be installed first. Most people connect with Remote Desktop on port 3389.

I lost my private key. How do I get back in?

Open the browser console in the panel, log in with the password, and add the public half of a new key to authorized_keys. A lost private key cannot be restored from the server, because only the public half is stored there.

Is it safe to use one SSH key for several servers?

Yes. The servers see only the public half, so one of them cannot use it to enter another. What matters is one key per device, a passphrase, and not enabling agent forwarding to machines you do not trust.

Read next

All VPS pages

This page in other languages: Azərbaycanca · Русский · Türkçe

Servers in Baku, prices in manat

Create an account, top up your balance and order the plan you need.