CortexHosting

How to SSH into a server from Windows, macOS or Linux

Last changed . CortexHosting is not open yet, so you can’t order a server today.

To SSH into a server, open a terminal on your computer and type ssh, your user name, @ and the server's address:

ssh myuser@203.0.113.10

This works in Windows 10 and 11, macOS and Linux. You don't need to install anything on most computers.

What you need

Connect

  1. Open a terminal. On Windows, use PowerShell. On macOS, use Terminal.
  2. Type the command above, with your own user name and address.
  3. The first time, SSH asks if you trust this server. Type yes.
  4. You are in when you see the server's prompt. Type exit to leave.

Make an SSH key

A key is safer than a password, and you don't have to type it each time. These commands work on all three systems:

ssh-keygen -t ed25519

Press Enter to save it in the normal place. You can add a passphrase, which protects the key if someone copies it.

This makes two files. The one ending in .pub is your public key, and it is safe to share. The other one is your private key. Never share it or send it to anyone.

Show your public key so you can copy it:

Your computerCommand
Windows (PowerShell)Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub
macOS or Linuxcat ~/.ssh/id_ed25519.pub

To add the key to a server you can already log in to, put that one line at the end of ~/.ssh/authorized_keys on the server.

When it does not work

What you seeWhat it meansWhat to do
Permission denied (publickey), sometimes with more words in the bracketsThe server doesn't accept your key for this userCheck the user name. Check that your public key is on the server
Connection timed outYour computer can't reach the serverCheck the address. Check that the server's firewall allows port 22
Connection refusedThe server answered, but SSH is not listening on that portCheck that SSH is running. Your server may use another port. Use ssh -p 2222 myuser@203.0.113.10 to try one
REMOTE HOST IDENTIFICATION HAS CHANGEDThe server's identity is not the one your computer remembersThis is normal if you just reinstalled the server. If you didn't, stop and find out why. Then run ssh-keygen -R 203.0.113.10
UNPROTECTED PRIVATE KEY FILEOther people on your computer can read your keyOn macOS or Linux, run chmod 600 ~/.ssh/id_ed25519
The key is on the server, but it still asks for a passwordThe server may be ignoring the key because of its file permissionsOn the server, run chmod 700 ~/.ssh and chmod 600 ~/.ssh/authorized_keys

Restart SSH on the server

If you have another way in, such as a web terminal, you can check SSH there. Its name depends on the system:

SystemCheck itRestart it
Ubuntu or Debiansudo systemctl status sshsudo systemctl restart ssh
Rocky Linux, AlmaLinux or RHELsudo systemctl status sshdsudo systemctl restart sshd

Doing this on CortexHosting

  1. Add your public key in Settings, under SSH keys. Press Add an SSH key.
  2. Pick the key when you make a new server. For a server you already have, open it and go to SSH keys.
  3. Connect with the user name cortex:

    ssh cortex@your-server-address

Logging in as root is switched off on servers we run. On a VPS, cortex can use sudo to do anything root can do. On a Managed server, no account has sudo.

Don't have a key, or can't get in? Open your server and go to Console. It gives you a terminal in your browser.