Open a terminal and run ssh root@your-server-ip. It works the same from Windows 10 and 11, macOS and Linux, with a password or an SSH key.
Connect for the first time
Open a terminal. On Windows, open PowerShell or Terminal from the Start menu: Windows 10 and 11 already include the OpenSSH client. On macOS, open Terminal. On Linux, open your terminal app.
Connect as root. Replace
203.0.113.10with your server's IP address:ssh [email protected]If your server listens on a different SSH port, add
-pand the port number:ssh -p 2222 [email protected]The first time, SSH shows the server's key fingerprint and asks Are you sure you want to continue connecting. Type
yesand press Enter. Your computer remembers the server from now on.Type the root password and press Enter. Nothing appears on the screen while you type: that's normal.
You're in when the prompt changes to something like root@server:~#. Check which system you're on:
cat /etc/os-release
hostname
The first command shows the Linux version (for example Ubuntu 24.04 or AlmaLinux 9), the second the server's name. Type exit to close the connection.
Log in with an SSH key instead of a password
A key is safer than a password and you don't have to type anything to log in. You create the key pair on your own computer, then copy the public half to the server.
On your computer, create a key (press Enter to accept the default file, then set a passphrase):
ssh-keygen -t ed25519This creates a private key
id_ed25519and a public keyid_ed25519.pubin the.sshfolder of your user. Never share the private key.Copy the public key to the server. On macOS and Linux:
ssh-copy-id [email protected]Windows has no
ssh-copy-id. In PowerShell, use this instead (one line):type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh [email protected] "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"Both ask for the root password one last time.
Test it: run
ssh [email protected]again. If it logs you in without the root password (it may ask for your key's passphrase), the key works.
Turn off password logins (optional)
Once your key works, you can stop password logins so nobody can guess their way in. Keep your current SSH session open while you do this, and test from a second window before you close it.
printf 'PasswordAuthentication no\nPermitRootLogin prohibit-password\n' > /etc/ssh/sshd_config.d/10-key-only.conf
sshd -t
The first line creates a small settings file. The file name starts with 10- so it's read before files such as 50-cloud-init.conf, which can switch passwords back on. sshd -t checks the settings and prints nothing when they're fine. Then reload SSH:
# Ubuntu
systemctl reload ssh
# AlmaLinux, Rocky Linux, CloudLinux
systemctl reload sshd
Check the result. Both lines should show the values you set:
sshd -T | grep -Ei '^(passwordauthentication|permitrootlogin)'
Now open a new terminal window and log in with your key. Only close the old session when that works.
Common problems
"Connection timed out"
Your computer can't reach the server. Check the IP address, check that the server is running, and check that a firewall on the server (or on your network) allows the SSH port, normally 22.
"Connection refused"
The server answers, but nothing listens on that port. SSH may run on another port (use -p), or the SSH service is stopped. If you can reach the server through a console, start it with systemctl start ssh on Ubuntu or systemctl start sshd on AlmaLinux.
"Permission denied (publickey)"
The server only accepts keys, and your key isn't on it or isn't the one SSH offers. Point SSH at the right key with ssh -i ~/.ssh/id_ed25519 [email protected]. If password logins were turned off before your key was copied, you need console access to add the key.
"REMOTE HOST IDENTIFICATION HAS CHANGED"
This appears after the server was reinstalled, because it now has a new key. If you know the server was reinstalled, remove the old entry on your computer and connect again:
ssh-keygen -R 203.0.113.10
If nobody reinstalled the server, don't connect: contact us first.
If you'd rather not manage the server yourself, ElySpace also offers managed servers.
Related articles
- Change the hostname of a Linux server
- Install the Apache web server on Ubuntu
- Zip and unzip folders over SSH
- Install cPanel & WHM on AlmaLinux
Still stuck? Open a support ticket and we'll help.