Skip to content
HOSTIGAN
VPS

How to connect to a Linux VPS with SSH

Connect to your Linux VPS with SSH from Windows, macOS or Linux: first login, host keys, a sudo user, SSH keys, a config file and fixes for the most common errors.

Beginner 5 min read Updated November 24, 2026

SSH (Secure Shell) is how you work on a Linux server: an encrypted connection that gives you a command line on the remote machine, as if you were sitting in front of it. You don't get a desktop — you get a terminal, and that is all you need to install software, edit configuration and keep the server running. This guide takes you from your very first login to a setup with a personal user, SSH keys and a shortcut that connects you with one word.

What you need before you connect

Your welcome email or the client area gives you the details:

  • IP address — IPv4 such as 203.0.113.10, and usually an IPv6 address too.
  • Username — often root on a fresh VPS.
  • Password or SSH key — whichever was set when the server was created.
  • Port — 22 unless you have changed it.

The basic command is the same everywhere:

ssh root@YOUR_SERVER_IP

Connecting from Windows, macOS and Linux

Windows 10 and 11

Windows ships with the OpenSSH client. Open Windows Terminal or PowerShell and type the command above. If Windows says ssh is not recognised, install the client from an administrator PowerShell:

Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

PuTTY still works if you prefer a graphical client: enter the IP in Host Name, keep port 22 and connection type SSH, give the session a name and click Save so you don't have to type it again. In PuTTY, selecting text copies it and a right-click pastes.

macOS and Linux

Open Terminal and use ssh directly. A few useful variations:

ssh root@YOUR_SERVER_IP                 # default port 22
ssh -p 2222 alice@YOUR_SERVER_IP        # custom port
ssh alice@2001:db8::10                  # IPv6 address

Your first login and the host key

The first time you connect, you will see something like this:

The authenticity of host '203.0.113.10 (203.0.113.10)' can't be established.
ED25519 key fingerprint is SHA256:Xb3k...q9w.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

Your computer has never seen this server and asks you to confirm its identity. Type yes, and the key is saved in ~/.ssh/known_hosts. From then on, SSH checks automatically that you are talking to the same server.

If you want to be thorough, compare the fingerprint with the one the server reports itself — for example via the console in the client area:

ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub

If you later see "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!", the server's key is different from the one you saved. After a reinstall that is expected; otherwise, find out why before you continue. Once you are sure it is legitimate, remove the old key:

ssh-keygen -R YOUR_SERVER_IP

Create a personal user with sudo

Working as root all day is risky: there is no safety net and no record of who did what. Create your own user and give it administrator rights through sudo.

On Ubuntu and Debian:

adduser alice
usermod -aG sudo alice

On AlmaLinux and Rocky Linux:

useradd -m -G wheel alice
passwd alice

Now open a second terminal and test before you close the root session:

ssh alice@YOUR_SERVER_IP
sudo whoami    # should print "root"

Tip: Always keep one working session open while you change anything about logins. If the new setup fails, you still have a way in to fix it.

Log in with SSH keys instead of passwords

An SSH key pair consists of a private key that stays on your computer and a public key that you place on the server. Keys can't be guessed like passwords, which makes them the single best protection against brute-force attacks.

Create a key on your own computer (Windows PowerShell, macOS or Linux):

ssh-keygen -t ed25519 -C "alice@laptop"

Accept the default location and choose a passphrase — it protects the key if your laptop is ever stolen. Then copy the public key to the server.

On macOS and Linux:

ssh-copy-id alice@YOUR_SERVER_IP

On Windows, which has no ssh-copy-id, use PowerShell:

type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh alice@YOUR_SERVER_IP "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

Log out and connect again. If you are only asked for the key's passphrase — not the server password — the key works. PuTTY users can create and convert keys with PuTTYgen.

Warning: Never share or upload your private key (id_ed25519 without .pub). Only the .pub file belongs on servers.

When key login works for your user, the next step is to switch off password and root login entirely. How to secure SSH on your Linux server walks through that safely.

Save time with an SSH config file

If you manage more than one server, put the details in ~/.ssh/config on your computer:

Host web1
    HostName 203.0.113.10
    User alice
    Port 22
    IdentityFile ~/.ssh/id_ed25519

Now ssh web1 is all you need to type. The same alias works for scp and sftp, for example scp backup.tar.gz web1:/home/alice/.

Two more settings are worth adding under Host * if your connection drops after a few idle minutes, which often happens behind home routers and office firewalls:

Host *
    ServerAliveInterval 60
    ServerAliveCountMax 3

Your client then sends a small keep-alive message every minute. For long jobs such as a big upgrade or a database import, run them inside tmux (install it with apt or dnf). If the connection drops, log in again and type tmux attach to pick up exactly where you left off — the job keeps running in the meantime.

Copy files over the same connection

SSH is not only for typing commands. The same login, key and port also move files, so you rarely need FTP on a VPS.

scp copies single files or folders in either direction:

scp site.tar.gz alice@YOUR_SERVER_IP:/home/alice/          # upload
scp alice@YOUR_SERVER_IP:/var/log/nginx/error.log .        # download
scp -r ./public alice@YOUR_SERVER_IP:/home/alice/site/     # a whole folder

For larger or repeated transfers, rsync is better: it only sends what has changed and can resume after an interruption.

rsync -avz --progress ./public/ alice@YOUR_SERVER_IP:/home/alice/site/

If you prefer a graphical program, FileZilla, WinSCP and Cyberduck all speak SFTP. Choose SFTP as the protocol, enter the server's IP, your username and port 22, and point the client to your private key. You get a familiar two-pane window, and everything travels encrypted over SSH.

Troubleshooting connection errors

ErrorWhat it usually meansWhat to check
Connection timed outNothing answers on that IP and portCorrect IP? VPS running? Firewall blocking port 22?
Connection refusedThe server answers but nothing listens on the portSSH service stopped, or running on another port
Permission denied (publickey)The server only accepts keys and yours isn't acceptedRight user? Public key in ~/.ssh/authorized_keys?
Permission denied (password)Wrong password, or password login is disabledKeyboard layout, Caps Lock, Fail2ban ban

For more detail, run SSH in verbose mode — it shows each step, including which keys it tries:

ssh -v alice@YOUR_SERVER_IP

If you have locked yourself out completely, use the console in the client area to log in and fix the problem — see How to restart, shut down and manage your VPS.

In short

Connect with ssh user@YOUR_SERVER_IP from any modern computer, accept the host key on the first login, and create a personal sudo user instead of working as root. Switch to Ed25519 keys, save your servers in ~/.ssh/config, and use ssh -v when something won't connect. Next, get comfortable on the command line with essential Linux commands and lock the server down with How to secure your VPS.

SSH access on a Hostigan VPS

Every Hostigan Linux VPS comes with full root access and both IPv4 and IPv6, so you can connect over SSH as soon as the server is ready. Choose Ubuntu, Debian, AlmaLinux or Rocky Linux — the commands in this guide work on all of them.

Frequently asked questions

SSH gives you a remote command line on the server. SFTP is a file transfer protocol that runs over the same SSH connection, so the same username, key and port work in clients such as FileZilla or WinSCP.

Next in “Get started with a VPS” · 7 of 11Linux server for beginners: the essential commands