---
title: "SSH into a remote server: first login, config and jump hosts · CloudSat"
description: "Connect to a remote server over SSH, verify its host key at first login, then set up a client config, jump hosts, keepalives, multiplexing and safe tunnels."
url: https://cloudsat.io/learn/ssh-client-setup-for-daily-server-work
updated: 2026-11-18T12:00:00Z
source: CloudSat (https://cloudsat.io/). Prices in USD.
---

[Remote access](https://cloudsat.io/learn/topic/remote-access)

# SSH into a remote server: first login, config and jump hosts

Connect to a remote server over SSH, verify its host key at first login, then set up a client config, jump hosts, keepalives, multiplexing and safe tunnels.

CloudSat team November 18, 2026 6 min read

The first SSH login is a single command. What makes it safe and pleasant every day after that lives on your side, in the client: checking the server's identity once, a config file that remembers hosts, jump hosts for private machines, keepalives, shared connections and tunnels to services that should never face the internet. Everything below uses OpenSSH, which ships with Linux, macOS and Windows, so the commands are the same on all three.

## The first connection

```bash
ssh admin@203.0.113.10
```

On the first visit the client cannot know whether the machine answering is really your server, so it asks:

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

Answering `yes` stores that key in `~/.ssh/known_hosts`, and from then on the client refuses to connect if the key changes. That makes the first answer the one that matters. Compare the fingerprint with the real one, read through a channel an attacker cannot sit in, such as the provider's web console:

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

If the two match, type `yes`. If a later login stops with a warning that the remote host identification has changed, do not click through: either the server was rebuilt and has new keys, or something is intercepting the connection. Confirm which before you remove the old entry with `ssh-keygen -R 203.0.113.10`.

## Run commands without opening a shell

A command after the host runs remotely and returns its output, which is handy for quick checks and scripts:

```bash
ssh admin@203.0.113.10 'uptime; df -h /'
ssh -t admin@203.0.113.10 'sudo systemctl restart nginx'
```

`-t` allocates a terminal, which `sudo` needs to ask for a password. To run a script that lives on your computer without copying it first, feed it to a remote shell: `ssh web-01 'bash -s' < check-disk.sh`.

## Write a client config

Typing addresses, users and keys gets old, and mistakes creep in. Describe each server once in `~/.ssh/config` (on Windows, `C:\Users\you\.ssh\config`):

```text
Host web-01
    HostName 203.0.113.10
    User admin

Host db-01
    HostName 10.8.0.11
    User admin
    ProxyJump web-01

Host *
    IdentityFile ~/.ssh/id_ed25519
    IdentitiesOnly yes
    ServerAliveInterval 30
    ServerAliveCountMax 4
    AddKeysToAgent yes
```

Now `ssh web-01` is the whole command, and `scp`, `rsync`, `git` and editors with remote extensions read the same file. For each option, the first value found wins, so specific hosts go at the top and the `Host *` defaults at the end. When a setting does not seem to apply, ask the client what it will actually use:

```bash
ssh -G db-01 | grep -E '^(hostname|user|port|proxyjump|identityfile) '
```

Large setups split the file: an `Include ~/.ssh/config.d/*` line at the very top reads one file per project or customer.

## Reach private machines through a jump host

A database or internal server often has no public SSH port at all. A jump host, also called a bastion, is the one machine you can reach, and the client tunnels through it:

```bash
ssh -J admin@203.0.113.10 admin@10.8.0.11
```

The `ProxyJump` line in the config above does the same automatically. The connection to the inner server is encrypted end to end inside the outer one, and your private key never leaves your computer.

That is why `ProxyJump` beats agent forwarding (`ssh -A`). With forwarding, anyone who has root on the intermediate server can use your agent to log in elsewhere as you, for as long as your session lasts. Keep `ForwardAgent` off by default and enable it only for a host you fully control, if at all.

## Keep idle sessions alive

Home routers and firewalls forget idle connections, which shows up as a terminal that freezes after a coffee break. `ServerAliveInterval 30` makes the client send a small keepalive every 30 seconds, and `ServerAliveCountMax 4` gives up after four unanswered ones, so a dead link ends within two minutes instead of hanging. For jobs that must outlive your connection, start them inside `tmux` on the server and reattach later.

## Share one connection between sessions

On Linux and macOS, OpenSSH can reuse an open connection for new sessions, which makes the second `ssh`, `scp` or `git` call to the same host start almost instantly. Add to the `Host *` block:

```text
    ControlMaster auto
    ControlPath ~/.ssh/cm-%C
    ControlPersist 10m
```

`ssh -O check web-01` shows whether a master connection exists, and `ssh -O exit web-01` closes it. The OpenSSH build that ships with Windows does not support connection sharing, so leave these lines out of a config you use there.

## Reach private services through a tunnel

A database, admin panel or metrics page should listen only on `127.0.0.1` on the server. An SSH tunnel brings it to your computer without opening a port:

```bash
ssh -N -L 5433:127.0.0.1:5432 web-01
```

While that runs, a database client on your computer connects to `localhost:5433` and reaches PostgreSQL on the server's own port 5432. `-N` opens the tunnel without a remote shell. The local end listens on your loopback address only, so other machines on your network cannot use it. If the tunnel refuses to open, the server may have `AllowTcpForwarding no`, a sensible default on shared bastions.

## Read the error before you change anything

`ssh -v web-01` prints each step of the handshake, and the last lines usually name the problem:

| Message | Usual cause |
| --- | --- |
| `Connection timed out` | Wrong address, or a firewall drops the port |
| `Connection refused` | Nothing listens on that port: sshd stopped or moved |
| `Permission denied (publickey)` | Wrong user, or the server does not have this key |
| `Too many authentication failures` | The agent offered too many keys: set `IdentitiesOnly yes` |
| `Host key verification failed` | The stored host key no longer matches |

On CloudSat, the server's **Connect** card shows the exact command to use, and [Connect to a Linux server over SSH](https://cloudsat.io/docs/connect-over-ssh) walks through these errors for a new server.

## Post-quantum key exchange is now the default

OpenSSH 10.0 made the hybrid post-quantum algorithm `mlkem768x25519-sha256` the default key exchange, which protects recorded sessions against future quantum computers. OpenSSH 10.1 and later print a warning when a connection falls back to an older, non-post-quantum exchange; the `WarnWeakCrypto` option controls it. See what a connection negotiated with:

```bash
ssh -v web-01 exit 2>&1 | grep 'kex: algorithm'
```

If the warning appears, the fix belongs on the server: update its OpenSSH package rather than silencing the client.

## FAQ

### Do I need PuTTY on Windows?

No. Windows 10 and 11 include the OpenSSH client, and everything in this guide works in PowerShell. Creating and installing keys there is covered in [create SSH keys on Windows](https://cloudsat.io/learn/create-ssh-keys-on-windows).

### Are SSH and SSL the same thing?

No. Both encrypt traffic and both use public-key cryptography, but they are separate protocols. SSH gives you remote shells, file transfer and tunnels. TLS, the successor of SSL, protects HTTPS, mail and most other application traffic. A server usually runs both, on different ports.

### Why does my session freeze after a few idle minutes?

A router or firewall between you and the server dropped the idle connection. Set `ServerAliveInterval 30` in your client config, and the client will keep it busy.

### Can I keep a tunnel open permanently?

Yes, with a small systemd service on Linux or `autossh`, which restarts the tunnel when it drops. For several services or machines, a VPN usually becomes simpler than a collection of tunnels.

**Run it on CloudSat.** Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. [See plans](https://cloudsat.io/plans) or [deploy a server](https://dash.cloudsat.io/console/deploy).

## Keep reading

[All guides in Remote access](https://cloudsat.io/learn/topic/remote-access)

- [Create SSH keys on Windows 11 and use them on any server](https://cloudsat.io/learn/create-ssh-keys-on-windows): Security Create SSH keys on Windows 11 and use them on any server 6 min read
- [Change the SSH port without locking yourself out](https://cloudsat.io/learn/change-ssh-port-safely): Security Change the SSH port without locking yourself out 7 min read
- [rsync backups over SSH: versioned snapshots with --link-dest](https://cloudsat.io/learn/versioned-backups-with-rsync-over-ssh): Linux rsync backups over SSH: versioned snapshots with --link-dest 6 min read
- [Is VNC safe? How to secure it, and what to use instead](https://cloudsat.io/learn/secure-vnc-or-replace-it): Remote access Is VNC safe? How to secure it, and what to use instead 6 min read
