How to Connect to a Server via SSH: Windows, macOS and Linux Step by Step

How to Connect to a Server via SSH: Windows, macOS and Linux Step by Step

  1. Home
  2. Blogs
  3. How to Connect to a Server via SSH: Windows, macOS and Linux Step by Step

SSH is the standard way to manage a VPS or dedicated server: you use it to install software, edit configs, read logs and restart services. This guide shows how to connect to a server via SSH from Windows, macOS and Linux, how to switch from a password to an SSH key and what to do if the connection fails.

What you need

  • The server's IP address — it's in the email you get after ordering and in your dashboard;
  • a username — usually root on Linux servers;
  • a password or SSH key;
  • the port — 22 by default unless you changed it.

How to connect via SSH from Windows

Option 1. Windows Terminal or PowerShell (built-in OpenSSH)

Windows 10 and 11 come with an SSH client. Open Windows Terminal or PowerShell and run:

ssh root@SERVER_IP

On the first connection you'll be asked about the server's fingerprint — type yes. Then enter the password: characters aren't shown while you type, which is normal.

Option 2. PuTTY

  1. Download PuTTY from the official site putty.org and run it.
  2. In Host Name enter the server IP, port 22, connection type SSH.
  3. Click Open, accept the server key and enter your username and password.

To avoid retyping, save the session with the Save button. For a comparison of handy clients, see our article on SSH clients for Windows.

How to connect via SSH from macOS and Linux

Open Terminal and run the same command:

ssh root@SERVER_IP
# non-standard port:
ssh -p 2222 root@SERVER_IP

Log in with an SSH key instead of a password

A key is safer than a password: it can't be brute-forced, and you don't need to type a password on every login.

Step 1. Generate a key on your computer

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

Press Enter to save it in the default location (~/.ssh/id_ed25519) and optionally set a passphrase.

Step 2. Copy the public key to the server

# macOS / Linux:
ssh-copy-id root@SERVER_IP
# Windows PowerShell:
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh root@SERVER_IP "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Step 3. Test the login and disable passwords

Connect again — no password prompt this time. Once key login works, disable password login in /etc/ssh/sshd_config:

PasswordAuthentication no
PermitRootLogin prohibit-password

Then restart the service: sudo systemctl restart ssh. Keep your current session open until you've tested login in a new window.

The ~/.ssh/config file: connect with one word

If you have several servers, list them in ~/.ssh/config:

Host myvps
    HostName SERVER_IP
    User root
    Port 22
    IdentityFile ~/.ssh/id_ed25519

Now ssh myvps is enough.

Common SSH connection errors

Error Cause Fix
Connection timed out server is off, wrong IP, or the port is blocked by a firewall check the IP and server status in your dashboard, firewall rules
Connection refused the SSH service isn't running or listens on another port log in through the server console in your dashboard (or contact support) and run systemctl start ssh
Permission denied (publickey,password) wrong password, username or key check the username and password from the welcome email, check authorized_keys
REMOTE HOST IDENTIFICATION HAS CHANGED the server was reinstalled and its key changed ssh-keygen -R SERVER_IP and connect again
Can't connect after changing the port the new port isn't open in the firewall open it: ufw allow 2222/tcp

SSH security: the minimum

  • Key-only login, passwords disabled.
  • Fail2ban against brute force and UFW with only the needed ports open.
  • A separate sudo user instead of working as root all the time.
  • Regular updates: apt update && apt upgrade.

More in our Fail2ban and UFW setup guide. If you don't have a server yet, order a VPS — SSH access arrives right after payment.

FAQ

Can I connect via SSH from my phone?

Yes, with apps like Termius (iOS and Android) or JuiceSSH (Android).

How do I connect to a Windows Server?

Windows servers are usually managed over RDP (Remote Desktop) rather than SSH. SSH can be enabled via the OpenSSH Server feature.

How do I copy files to the server?

With scp file.zip root@IP:/root/ or SFTP clients such as FileZilla or WinSCP.

What if I forgot the server password?

Reset the root password in your dashboard or contact support to restore access.

Related articles

Money Safe Review: a Service for Manually Built White Pages for Media Buyers

Money Safe Review: a Service for Manually Built White Pages for Media Buyers

Partner content. Prepared by the Money Safe team. In affiliate marketing, there haven’t been any one-size-fits-all solutions that guarantee passing moderation for quite some time. The algorithm

502 Bad Gateway Error: What It Means and How to Fix It

502 Bad Gateway Error: What It Means and How to Fix It

502 Bad Gateway is one of the most common website errors: you open a page and get a blank screen saying "502 Bad Gateway". Let's look at what it means, who is to blame — the browser, the site or

ProxiesTrust.com: Multi-Country Proxies with Stable Performance

ProxiesTrust.com: Multi-Country Proxies with Stable Performance

Partner content. Prepared by the ProxiesTrust team. ProxiesTrust.com is a multi-country proxy service that partners value for its stability and performance. It is built for long-term use at a reasona

IpsTrust.com: Stable Proxies at Competitive Prices

IpsTrust.com: Stable Proxies at Competitive Prices

Partner content. Prepared by the IpsTrust team. Looking for reliable proxies for digital marketing, account management or system operations? IpsTrust.com provides proxy services built around a few si

TDS.ceo: a Tracker for Affiliate Marketing and Fast Traffic Launches

TDS.ceo: a Tracker for Affiliate Marketing and Fast Traffic Launches

Partner content. Prepared by the TDS.ceo team. When you launch traffic, you need to see what happens after the click: how many users reached the offer, where conversions came from, what the result co

FreePWA.com: Free PWAs for Gambling, Betting and Dating — and Your Own White-Label Service

FreePWA.com: Free PWAs for Gambling, Betting and Dating — and Your Own White-Label Service

Partner content. Prepared by the FreePWA team. In affiliate marketing you want to get to launch faster: pick an offer, prepare an app for the geo and send traffic. When every new idea means calculati

GetAntik: an Antidetect Browser with HollyProxy Proxies and TDS.ceo Statistics

GetAntik: an Antidetect Browser with HollyProxy Proxies and TDS.ceo Statistics

Partner content. Prepared by the GetAntik team. Working with multiple accounts quickly fills up with small tasks. One profile needs its proxy renewed, another has to be handed over to a colleague, an

ARNPROXY Review: Datacenter, ISP and Residential Proxies in One Dashboard

ARNPROXY Review: Datacenter, ISP and Residential Proxies in One Dashboard

If you run scrapers, SEO monitoring or automation on a server, the server is only half of the setup. The other half is the IP addresses your requests go out from. ARNPROXY is a proxy provider that cov

White Link Review: Stable White Pages

White Link Review: Stable White Pages

Hand-built white pages for Google, Meta, TikTok, Bing and other platforms — designed to pass moderation on the first try. White Link is a professional white page development service for media b

Telegram