Guide

How to SSH to a Linux server from Windows or Linux

To SSH to a Linux server, you need its address, a user name and a password or key. On Linux, run ssh user@address in a terminal; on Windows, use an SSH client or the same command in PowerShell. Check the server's host key the first time, then switch to key sign-in.

This guide walks you through connecting from Windows 10 or 11 and from another Linux machine, checking you've reached the right server, signing in with a key, and copying files.

  • Free SSH and SFTP client
  • Host key checks
  • Key sign-in

Updated · Windows 10 and 11, and Linux to Linux

What you need

  • The server's address: a host name like server.example.com or an IP address.
  • The SSH port. It's usually 22, but some hosts use another one.
  • A user name on the server, and that user's password or a private key the server accepts.
  • An SSH server running on the Linux machine. Most hosting providers set one up for you.

Your hosting provider's welcome email or control panel usually lists all of this. If the server also shows its host key fingerprint somewhere (many providers do), keep it handy for step 3.

How it works

SSH opens an encrypted connection from your PC to the server. Before you type a password, your SSH client checks the server's host key, a unique identity the server presents. That check is what stops someone in the middle from pretending to be your server. Once you're signed in, everything you type runs on the server, and the output comes back to your screen.

On Windows, this guide uses the SSH client built into RemoteAccessApp. It keeps your servers in a saved list, opens each one in a tab, and has a two-pane SFTP and FTP file manager next to the terminal. It's free for up to 5 saved hosts. On Linux, you already have everything you need: the ssh command comes with almost every distribution. Jump to SSH from Linux to Linux.

Step-by-step: connect from Windows with RemoteAccessApp

  1. Step 1: Install the Console

    Download RemoteAccessApp, run the installer (no admin rights needed) and pick the Console. Sign in, or create a free account first.

  2. Step 2: Add the server

    Open Connections and choose New SSH host. Enter a name, the address, the port and your user name. Save it, then double-click it to connect. If the connection is refused or times out, the help article can't connect to a server lists the usual causes.

  3. Step 3: Check the host key fingerprint

    The first time, RemoteAccessApp shows the server's key fingerprint and asks whether to trust it. Compare it with the one from your provider, or from the server itself (see below). Only trust it if they match. The password is sent only after this check.

  4. Step 4: Sign in

    Type the password, or use a key (next section). You can choose to remember a password; it's kept encrypted on your PC.

  5. Step 5: Try a few commands

    whoami shows who you're signed in as, uname -a the system, df -h the free disk space, and uptime how long it's been running. On Debian or Ubuntu, sudo apt update checks for updates.

Where to find the server's fingerprint

If you can already reach the server another way (for example your provider's web console), run ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub there. The SHA256 fingerprint it prints should match the one RemoteAccessApp shows. If a server's key ever changes later, RemoteAccessApp refuses the connection with a warning. That can mean the server was reinstalled, or that someone is intercepting the connection, so find out which before you continue.

Sign in with a key instead of a password

A key pair is much harder to guess than a password. The private half stays on your PC; the public half goes on the server.

  1. Step 1: Create a key pair

    If you don't have one, open PowerShell and run ssh-keygen -t ed25519. Choose a passphrase when asked. It saves the key in your user folder under .ssh.

  2. Step 2: Put the public key on the server

    Add the contents of the .pub file as a new line in ~/.ssh/authorized_keys for your user on the server.

  3. Step 3: Use the key in RemoteAccessApp

    Edit the host, choose Private key, and paste or import your private key. Passphrase-protected keys work; you can have the passphrase remembered, encrypted. From then on the host signs in with the key.

Move files with SFTP

SFTP uses the same SSH connection to copy files. From an open terminal, choose Files (SFTP), or save the server as an SFTP host. You get two panes, your PC on one side and the server on the other: drag files across, or select several and copy them in one go. FTP servers open in the same file manager.

Handy extras

  • Full-screen programs like htop, vim, nano and mc work in every tab.
  • Type a command once and send it to every open SSH tab, handy for updating several servers.
  • Your saved hosts follow your account to every PC you sign in on, without their passwords.
  • Open a saved SSH host in a browser terminal from your dashboard, even on a phone.
  • Save scripts you use often, run one on many hosts at once, pick startup scripts for a host and search your command history, from the Scripts panel (Ctrl+Shift+S).

Prefer the command line?

Recent versions of Windows 10 and Windows 11 also include a command-line ssh command. In PowerShell, ssh [email protected] connects in the same way and asks you to confirm the host key the first time. It's fine for a quick session. A dedicated client adds the saved list, tabs, the file manager and sending a command to many servers at once. Read more about the RemoteAccessApp SSH client.

SSH from Linux to Linux

Connecting from one Linux machine to another, say from your laptop to a home server or a cloud machine, uses the ssh command in a terminal. Here's the whole process.

  1. Step 1: Make sure the other machine runs an SSH server

    Servers almost always do. On a desktop machine, check with systemctl status ssh (Debian and Ubuntu) or systemctl status sshd (Fedora and similar). If it's missing, install your distribution's SSH server package and start it with sudo systemctl enable --now ssh (or sshd).

  2. Step 2: Find its address

    On the other machine, hostname -I prints its IP addresses on your network. For a cloud server, use the address or host name your provider shows.

  3. Step 3: Connect and check the host key

    Run ssh [email protected], with your user name and address. Add -p 2222 if the server uses another port. The first time, ssh shows the host key fingerprint and asks whether to continue: compare it with the output of ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub on the server, and type yes only if they match.

  4. Step 4: Set up key sign-in

    Create a key pair with ssh-keygen -t ed25519 (choose a passphrase), then copy the public half to the server with ssh-copy-id [email protected]. From now on you sign in with the key, and the private half never leaves your machine.

  5. Step 5: Save a shortcut

    Add the server to ~/.ssh/config as below, and ssh homeserver is all you need to type.

Host homeserver
    HostName 192.168.1.20
    User admin
    Port 22
    IdentityFile ~/.ssh/id_ed25519

Copy files between the two machines

The same SSH connection carries files. scp is quickest for a file or two, rsync is best for folders because it only sends what changed, and sftp gives you an interactive session with ls, get and put.

scp report.pdf homeserver:/tmp/
scp homeserver:/var/log/syslog ./syslog-copy
rsync -avz photos/ homeserver:backup/photos/
sftp homeserver

Run one command, or hop through a gateway

ssh homeserver 'df -h' runs a single command and prints the result without opening a shell. If the machine you want is only reachable through another one, such as a server on a private network behind a gateway, ssh -J admin@gateway [email protected] connects through the gateway in one step.

Lock it down once keys work

When key sign-in works for everyone who needs it, turn off password sign-in on the server: set PasswordAuthentication no and PermitRootLogin no in /etc/ssh/sshd_config, then run sudo systemctl reload ssh. Keep your current session open while you test a new one, so a typo can't lock you out. More in how to control who can access your servers.

Using RemoteAccessApp from a Linux desktop

The RemoteAccessApp apps run on Windows, but your saved SSH hosts also open in a terminal in the browser: sign in at remoteaccessapp.com on your Linux machine and choose Open terminal on your dashboard, free. Your saved scripts appear there too. The website's server makes that SSH connection for you, either directly or through one of your own PCs for addresses on your home network, so it's encrypted between our server and yours rather than end to end from your browser.

Questions, answered

Related