WESERVER / KNOWLEDGE BASE

How to connect to a VDS via SSH

You reach a Linux VDS with ssh user@ip from a terminal. Steps for Windows, macOS and Linux, key-based login and fixes for the most common SSH errors.

Short answer

To connect to a Linux VDS, run ssh user@server-ip in a terminal. Linux, macOS and current Windows versions ship with the OpenSSH client; on the first connection you confirm the server’s host key, then log in with your password or SSH key.

If the server IP is 203.0.113.10 and the user is root, the command is ssh [email protected]. The steps are identical on Ubuntu, Debian, AlmaLinux and Rocky Linux. Windows Server VDS instances are managed over Remote Desktop (RDP) instead.

What do you need for an SSH connection?

Before you try to connect, check that you have:

  • The server’s public IPv4 address (or its IPv6 address if you connect over IPv6)
  • A username: usually root on fresh installs; some images ship with a separate user such as ubuntu
  • A password or an SSH key that was already added to the server
  • The SSH port: 22 by default, or the number you changed it to
  • An SSH client: the ssh command on Linux and macOS, the OpenSSH client or PuTTY on Windows 10/11

How do you SSH into a VDS from Linux or macOS?

Open your terminal app and follow this order:

  • Start the connection: ssh [email protected]
  • If SSH does not listen on port 22, pass the port with -p: ssh -p 2222 [email protected]
  • On the first connection you will see “Are you sure you want to continue connecting (yes/no/[fingerprint])?”; check the fingerprint, then type yes
  • Type the password when prompted and press Enter; nothing appears on screen while you type, by design
  • A prompt like root@server-name:~# means you are in; type exit to leave

How do you connect over SSH from Windows?

Windows 10 (version 1809 and later) and Windows 11 include the OpenSSH client. Open PowerShell or Windows Terminal and use the same command as on Linux: ssh [email protected]. If the command is missing, add “OpenSSH Client” under Settings → Apps → Optional features.

With PuTTY, enter the IP address in Host Name, 22 (or your custom port) in Port, keep the connection type on SSH and click Open. On the first connection PuTTY asks whether to cache the host key; accept it if the fingerprint matches. Then enter the username at “login as” and the password after it.

PuTTY stores keys in its own .ppk format. To use a key generated with OpenSSH, import it in PuTTYgen and save it as .ppk.

What does the host key warning on first connect mean?

SSH identifies a server by its host key. On the first connection the key’s fingerprint is written to the known_hosts file on your computer, and every later connection expects the same key. This stops you from sending your password to an impostor server sitting in the middle.

Reinstalling the server (a new OS or a reinstall) generates a new host key, and SSH aborts with “WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!”. If you know why it changed, remove the old entry with ssh-keygen -R 203.0.113.10 and connect again. If you do not, confirm with your provider before connecting.

How do you use an SSH key instead of a password?

Key-based login makes password-guessing attacks largely useless and saves you typing a password on every connection. The private key (id_ed25519) never leaves your computer; only the public .pub key goes to the server. Setup takes three steps:

  • Generate a key pair: ssh-keygen -t ed25519 -C "laptop-2026". If you set a passphrase when asked, a stolen key file is useless on its own.
  • Copy the public key to the server. On Linux and macOS: ssh-copy-id [email protected]. In Windows PowerShell: 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"
  • Test it from a new terminal with ssh [email protected]; if you get in without a password prompt, the key works.

Is it safe to disable password login?

Once key login works, you can turn off password login. Set PasswordAuthentication no in /etc/ssh/sshd_config and restart the SSH service: systemctl restart ssh on Ubuntu and Debian, systemctl restart sshd on AlmaLinux and Rocky Linux.

On Ubuntu, files under /etc/ssh/sshd_config.d/ can override the main file, so check the same setting there too. Keep your current session open while you make the change and test from a second window. If a setting is wrong, the first session is still there to fix it.

How do you shorten connections with ~/.ssh/config?

If you manage several servers, save the IP, port and user under an alias in ~/.ssh/config instead of typing them each time. On Windows the file lives at C:\Users\<user>\.ssh\config. With the entry below, ssh weserver-vds is enough, and the alias also works in tools that run over SSH, such as scp and rsync:

  • Host weserver-vds
  • HostName 203.0.113.10
  • User root
  • Port 22
  • IdentityFile ~/.ssh/id_ed25519

How do you fix SSH connection errors?

When a connection fails, get verbose output first with ssh -v [email protected]; the error message usually points to the layer where things break:

  • Connection timed out: packets are not reaching the server. Check the IP address, that the server is running, and that its firewall (ufw, firewalld) is not blocking the SSH port.
  • Connection refused: the server is reachable but nothing listens on that port. The SSH service may be stopped or the port changed; pass the right port with -p and check the service with systemctl status ssh (sshd on RHEL-based distributions).
  • Permission denied (publickey): the server has password login disabled and does not recognise your key. Check the username, that your public key is in authorized_keys, and the permissions (700 for ~/.ssh, 600 for authorized_keys). To try a specific key, use ssh -i ~/.ssh/id_ed25519.
  • Permission denied, please try again: the password is wrong or password login for root is disabled (the PermitRootLogin setting). Make sure copy-paste did not add a trailing space.
  • REMOTE HOST IDENTIFICATION HAS CHANGED: the host key changed. If you reinstalled, remove the old entry with ssh-keygen -R; if you did not, find out why before connecting.

Should you use SSH or RDP for a Windows Server VDS?

On WeServer VDS, Linux servers are accessed with root/SSH and Windows Server instances with Remote Desktop (RDP). On Windows, open the Remote Desktop Connection app (mstsc) and enter the IP address and administrator credentials.

You can also install the OpenSSH Server component on Windows Server; some teams run it next to RDP for command-line automation or file transfer. In that case you need to open port 22 in Windows Defender Firewall separately. The same care applies when you first enable a firewall on Linux: on Ubuntu, run ufw allow OpenSSH before ufw enable, otherwise you cannot get back in over SSH once your current session closes.

Frequently asked questions

Does changing the SSH port improve security? It cuts down the log noise from automated scans but offers no real protection by itself. Key-based login with password login disabled is what makes the difference.

Is logging in as root a problem? Root can run any command without limits. A separate user with sudo rights for daily work, plus direct root login disabled (PermitRootLogin no), is a safer setup.

What happens if I lose my SSH key? The private key exists only on your computer and cannot be regenerated. If password login is off, you have to reach the server another way and add a new public key, so keep a secure backup of the key.

Can I connect over SSH from my phone? Yes, there are SSH client apps for iOS and Android. The IP, user and port stay the same; if you use a key, import it into the app.

Why does the connection drop when idle? Network devices along the path may close connections that carry no data for a while. Adding ServerAliveInterval 60 to ~/.ssh/config makes the client send a keep-alive at regular intervals so the session stays open.

Browse related productsAsk on WhatsApp← Back to category

RELATED

Related articles

ALL IN WE1

Let’s build your infrastructure.

Share your requirements and we will help you choose the right resources and server type.

Talk on WhatsApp