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 computer | Where you type the commands | Where your keys are saved |
|---|---|---|
| Windows 10 (1809 or later) or 11 | PowerShell or Command Prompt | %USERPROFILE%\.ssh (your user folder, then .ssh) |
| macOS | Terminal | ~/.ssh (the hidden .ssh folder in your home) |
| Linux | Your 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
- Open the program from the table above.
- Type
ssh-keygen -t ed25519and press Enter. Ed25519 is a modern key type; naming it guarantees you get it on any version. - At the file-name prompt, accept the offered name,
id_ed25519, with Enter. - 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.
- Two lines confirm the save. You now hold two files:
id_ed25519(keep it secret) andid_ed25519.pub(the half you share). - Print the public key so you can copy it:
cat ~/.ssh/id_ed25519.pubon macOS or Linux,Get-Content $env:USERPROFILE\.ssh\id_ed25519.pubin PowerShell. You should see one long line starting withssh-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
- Look up the IP address and user name in your dashboard. The examples below use
203.0.113.10androotas stand-ins; put your own in their place. - Type
ssh root@203.0.113.10and press Enter. If your key lives somewhere else, point to it:ssh -i path/to/your/key root@203.0.113.10. - 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. - Type your key's passphrase if you set one. Nothing appears on screen while you type; that is normal.
- A new prompt ending in
#or$means the server is listening. Typeexitwhenever 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.
- Install pending updates:
sudo apt update && sudo apt upgrade. Afterwards Ubuntu applies security fixes by itself through the preinstalledunattended-upgradespackage. - 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.
- 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. Answeryto 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 verboseshould show port 22 allowed on both. Anything you add later, such as a web server, needs its own allow rule. - 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. - Check the settings and restart SSH only if they pass:
sudo sshd -t && sudo systemctl restart ssh.service. Confirm withsudo sshd -T | grep -i passwordauthentication; the answer should bepasswordauthentication no. - 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_keysand 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 statusafter 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.