How to SSH into your cloud server, from your first key to a locked door

To SSH into a cloud server you need three things: a key pair made on your own computer, the server's address, and one short command typed into a terminal, ssh user@address. This guide takes you through each one on Windows, macOS and Linux, then through the first few minutes after you are in: updates, a firewall that keeps your way in open, and switching off password logins. By the end you will reach your server from your laptop with one short command, and it will answer only to your key.

By the Stream Brothers team

Every step was checked against the software's official documentation by independent reviewers before publishing. Last reviewed .

Before you start

Running order
  1. Before you begin: three ingredients
  2. Make your key pair
  3. Hand the server your public key
  4. Your first login, step by step
  5. Lock the door in your first ten minutes
  6. Keeping it that way
  7. Is a cloud server the right place for your project?
  8. Your questions

Before you begin: three ingredients

You need a computer with an SSH client, a cloud server, and about twenty quiet minutes. SSH (Secure Shell) opens a text window onto another machine and encrypts everything that passes between the two. Instead of a password it can use a key pair: a private key that stays on your computer and works like a password, and a matching public key you can hand out freely, because it only opens doors for its private partner.

Your computerWhere you type the commandsWhere your keys are saved
Windows 10 (1809 or later) or 11PowerShell or Command Prompt%USERPROFILE%\.ssh (your user folder, then .ssh)
macOSTerminal~/.ssh (the hidden .ssh folder in your home)
LinuxYour terminal app~/.ssh

If Windows answers that ssh is not recognised, open Optional Features from the Start menu, find OpenSSH Client and add it, then open a fresh PowerShell window.

Make your key pair

  1. Open the program from the table above.
  2. Type ssh-keygen -t ed25519 and press Enter. Ed25519 is a modern key type; naming it guarantees you get it on any version.
  3. At the file-name prompt, accept the offered name, id_ed25519, with Enter.
  4. Choose a passphrase: a few words that unlock the key file, so a stolen laptop does not hand over your server. Store it safely; a forgotten passphrase cannot be retrieved, only replaced by a brand-new key.
  5. Two lines confirm the save. You now hold two files: id_ed25519 (keep it secret) and id_ed25519.pub (the half you share).
  6. Print the public key so you can copy it: cat ~/.ssh/id_ed25519.pub on macOS or Linux, Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub in PowerShell. You should see one long line starting with ssh-ed25519. Copy all of it.

Only ever paste the line from the .pub file. The file without an extension is your private key: anyone holding it can log in as you, so it never goes into an email, a chat or a web form. Back the private key up too, for instance in a password manager.

Hand the server your public key

On a Stream Brothers cloud server, the SSH key is set when the server is created, so you give it your public key line at that point; the access method can be changed afterwards. The server is ready minutes after payment, and its address and access details appear in your dashboard. Prefer a windowed program such as PuTTY to a terminal? Open a ticket and ask for help setting it up.

To add a second computer later, open ~/.ssh/authorized_keys on the server: it holds one public key per line, so paste the new .pub line as a separate line. Only your user may be able to change that file, or the SSH service ignores it; chmod go-w ~/.ssh/authorized_keys removes everyone else's write access.

Your first login, step by step

  1. Look up the IP address and user name in your dashboard. The examples below use 203.0.113.10 and root as stand-ins; put your own in their place.
  2. Type ssh root@203.0.113.10 and press Enter. If your key lives somewhere else, point to it: ssh -i path/to/your/key root@203.0.113.10.
  3. The first time, ssh shows the server's fingerprint (a short code identifying that machine) and asks whether to carry on. Type yes. Your computer remembers the server from now on.
  4. Type your key's passphrase if you set one. Nothing appears on screen while you type; that is normal.
  5. A new prompt ending in # or $ means the server is listening. Type exit whenever you want to leave.

If ssh ever warns that the server's identification has changed, stop. It is expected right after you reinstall the server; at any other time something may sit between you and your machine, so open a ticket before you clear the old entry.

To skip typing the address, create a plain text file called config inside your .ssh folder with a nickname block:

Host mycloud
    HostName 203.0.113.10
    User root
    IdentityFile ~/.ssh/id_ed25519

Save it, and ssh mycloud does exactly what the long command did.

Lock the door in your first ten minutes

Three small jobs turn a fresh server into a safe one: install updates, fence it with a firewall, and refuse passwords. These commands are for Ubuntu; other systems use different tools. sudo runs a command as the administrator and does no harm if you are already root.

  1. Install pending updates: sudo apt update && sudo apt upgrade. Afterwards Ubuntu applies security fixes by itself through the preinstalled unattended-upgrades package.
  2. Leave this window open for the rest of the list, and open a second terminal for testing. If a change goes wrong, the first window is still logged in and can undo it.
  3. Allow SSH and switch the firewall on in one line, so the firewall never starts unless the SSH rule went in: sudo ufw allow ssh && sudo ufw enable. Answer y to the warning about existing connections. ufw, Ubuntu's firewall tool, blocks incoming traffic by default, and its rules reach IPv6 traffic too with no extra setup. sudo ufw status verbose should show port 22 allowed on both. Anything you add later, such as a web server, needs its own allow rule.
  4. Turn off password logins. Open a new settings file with sudo nano /etc/ssh/sshd_config.d/00-keys-only.conf, type the three lines shown below, then press Ctrl+O, Enter and Ctrl+X to save and close.
  5. Check the settings and restart SSH only if they pass: sudo sshd -t && sudo systemctl restart ssh.service. Confirm with sudo sshd -T | grep -i passwordauthentication; the answer should be passwordauthentication no.
  6. In your second window, log in with your key as usual; it should work. Then try ssh -o PubkeyAuthentication=no root@203.0.113.10, which tells ssh to skip your key. It must be refused. Only now close the first window.
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin prohibit-password

Why the 00- in the file name? The SSH service keeps the first value it reads for each setting, and Ubuntu reads this folder before the main settings file, so a name starting with 00 goes ahead of the others there. The last line still lets root in with a key, never with a password.

Keeping it that way

  • Give every computer its own key. If a laptop goes missing, delete its one line from authorized_keys and the rest carry on.
  • Slow down password guessers with sudo ufw limit ssh/tcp, which turns away an address opening six or more connections within 30 seconds.
  • Check sudo ufw status after installing anything new, so you know what the internet can reach.
  • Running a bot or a relay that should never stop? Our guide to running a Python script around the clock keeps it alive and tells you when it quietly dies.
  • Prefer a name to a bare IP? Connect your domain by adding an A record holding the server's address.

Is a cloud server the right place for your project?

A cloud server suits work that needs a whole machine you control. Each is a KVM virtual server located in New York: you get root access, one public IPv4 address and a 1 Gbps port, in sizes S to XXL you can move up through as you grow, month to month. An elastic option is billed by the second while the server runs, handy for a machine you switch on only for events. Typical jobs are a relay, a transcoder, a bot or a whole website stack.

The trade-off: you look after updates, the firewall and backups yourself. If all you need is a website or WordPress, web hosting is the easier road, with a control panel, free SSL, nightly backups free for the first 12 months, and SSH and SFTP for the odd command. And if you only want to stream video or radio, those plans need no server at all.

Ready to log in to a server of your own?

Pick a size, set your SSH key when the server is created, and your server's address appears in your dashboard within minutes of payment.

Your questions

Can I use PuTTY on Windows instead of the ssh command from OpenSSH Client?

Yes. PuTTY is a windowed SSH program that reads keys in its own format, made or converted with its companion tool PuTTYgen; you can ask our help team about either. OpenSSH Client is an optional feature of Windows itself, so this guide sticks with it.

What happens if I lose my private key or forget its passphrase?

Neither can be recovered, so you make a new key pair. If another of your computers still has access, log in from there and add the new public key to authorized_keys. If nothing can get in, the access method can be changed after the server is created; open a ticket and ask.

Is it safe to share my public key?

Yes. The line from the .pub file is designed to be handed out; it lets a server recognise you but cannot log anyone in by itself. The private key is the one to guard.

Why does ssh say permission denied?

Usually it is the wrong user name, the wrong key file, or a key that never reached the server. Check the user name in your dashboard, point to the key with -i, and add -v to the command, which prints each step and shows which keys ssh offered.

Should I move SSH away from port 22?

It is not required. Key-only logins and a firewall do the real protecting, and a moved port means an extra -p setting on every connection and firewall rule. If you do move it, allow the new port in ufw before restarting SSH.

Who can I ask if I get stuck?

Help is available around the clock: an AI chat assistant, a human whenever you ask for one, and tickets from your account. Say which step you reached and copy the exact message you see.