Connecting to a Linux server over SSH

Reach your Linux VPS or dedicated server from Windows, macOS and Linux — plus key-based login instead of passwords.

5 min Updated 18 Jul 2026

Once your Linux server is delivered, you manage it over SSH. This guide covers connecting from all three operating systems, then the safer key-based login.

What you need

Your service delivery email contains:

  • Server IP address
  • Username — usually root on Linux
  • Password
  • SSH port — 22 by default

Connecting from Windows

Windows 10 and later ship with a built-in SSH client. Open PowerShell or Command Prompt:

ssh root@YOUR_SERVER_IP

If the SSH port has been changed:

ssh root@YOUR_SERVER_IP -p 2222

On first connection you will see a host authenticity prompt; type yes to accept. If you prefer a graphical client, PuTTY is a solid choice.

Connecting from macOS or Linux

Open Terminal and run the same command:

ssh root@YOUR_SERVER_IP

Key-based login instead of passwords

Password login is vulnerable to brute-force attacks, and public servers are targeted constantly. Key-based login is both safer and more convenient.

1. Generate a key pair

On your own computer (not on the server):

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

When prompted for a passphrase, set one — it is your second layer of protection if your laptop is ever lost.

2. Copy the public key to the server

ssh-copy-id root@YOUR_SERVER_IP

If ssh-copy-id is unavailable, append the contents of ~/.ssh/id_ed25519.pub to ~/.ssh/authorized_keys on the server.

3. Test, then disable password login

Confirm key login works first and keep your current session open. Then in /etc/ssh/sshd_config:

PasswordAuthentication no
PermitRootLogin prohibit-password

And restart the service:

systemctl restart sshd

Warning: test the connection in a new window before closing your current terminal. If the configuration is wrong and you close it, you lock yourself out and will need emergency console access to recover.

Common errors

  • Connection timed out — usually a firewall blocking the port, or the wrong IP.
  • Permission denied — wrong username or password, or password login is disabled.
  • Host key verification failed — the server was rebuilt and its host key changed. Remove the old entry from ~/.ssh/known_hosts.
Was this page helpful?