Talk to the NOC, IST hours — +91 75994 50220 support@bigdomainhost.com
Guide

What is a bastion host? SSH jump servers, ProxyJump and how to lock them down

Once you run more than one or two servers, leaving SSH open to the internet on every one of them gets hard to watch. A bastion host gives you a single, hardened front door instead. This guide explains what a bastion is, how to connect through one with OpenSSH's ProxyJump, and the mistakes that undo the benefit.

Short answer: A bastion host is a single hardened server that sits between the internet and your private servers and is the only machine that accepts administrative logins from outside. You SSH to the bastion first, then hop to internal servers over a private network. OpenSSH does the hop for you with ProxyJump (ssh -J), so your private keys never leave your laptop.

What is a bastion host?

A bastion host is a server whose only job is to be the controlled entry point into a private network. NIST's glossary defines it as a special-purpose computer built and configured to withstand attacks. In day-to-day hosting the same machine is often called a jump server, jump host or jump box: you jump through it to reach the servers behind it.

The layout is simple. Your database, application and cache servers have SSH reachable only on a private network. One small server, the bastion, has SSH reachable from the internet. To manage anything, you SSH into the bastion first and from there into the target. Nothing else on the network accepts a login from outside.

A bastion is not a firewall and not a VPN, although it is often used alongside both. It is an ordinary Linux server with almost everything removed, so that the one service it does run, SSH, is easy to audit and hard to attack.

Why use a bastion host?

  • One door to guard instead of ten. Every server with port 22 open to the internet gets constant password-guessing and scanning. With a bastion, only one machine faces that traffic, and you can harden, patch and watch it closely.
  • One place to log and audit. Every administrative session passes through the bastion, so its logs show who connected, when, from which IP address and with which key.
  • Simpler firewall rules. Internal servers need one rule: accept SSH only from the bastion's private IP. Adding a new team member or a new office IP changes the bastion only.
  • Faster offboarding. When someone leaves, removing their key from the bastion cuts off access to everything behind it, even if a stray key remains on an internal server.
  • Smaller attack surface for data servers. A database server with no public SSH and no public database port has very little for an outsider to probe.

The trade-off is that the bastion becomes a single point of failure for admin access, and a valuable target. Both are manageable: keep a second way in (a provider console or a second bastion), and treat the bastion as the most locked-down machine you own.

How SSH through a bastion works: ProxyJump

The old way was to SSH into the bastion, then run ssh again from there. That needs your private key, or a forwarded agent, on the bastion, which is exactly what you want to avoid. OpenSSH 7.3, released in August 2016, added a cleaner method: the ProxyJump option and its -J flag.

With ProxyJump, your laptop opens an SSH connection to the bastion and asks it to forward a TCP connection to the internal server. Your laptop then runs a second, end-to-end encrypted SSH session to the internal server through that tunnel. The bastion only passes bytes along. It never sees your private key, and it cannot read the inner session.

One command does the whole hop:

ssh -J deploy@bastion.example.in deploy@10.10.0.12

Here bastion.example.in is the bastion's public name and 10.10.0.12 is the internal server's private IP address. You can chain several hops with commas, for example -J user@hop1,user@hop2, and a non-standard port with user@host:2222.

The same works for file copies, because scp and sftp accept -J too. Our guide to SFTP and SCP covers the rest of their options.

scp -J deploy@bastion.example.in backup.sql deploy@10.10.0.12:/home/deploy/

Setting up ~/.ssh/config for a jump host

Typing -J every time gets old quickly. Put the bastion and your internal servers in ~/.ssh/config on your laptop instead:

# The bastion: the only host reachable from the internet
Host bastion
    HostName bastion.example.in
    User deploy
    IdentityFile ~/.ssh/id_ed25519
    ForwardAgent no

# Internal servers: reached through the bastion over the private network
Host app1
    HostName 10.10.0.11
    User deploy
    ProxyJump bastion

Host db1
    HostName 10.10.0.12
    User deploy
    ProxyJump bastion

# Or cover a whole private range at once
Host 10.10.0.*
    User deploy
    ProxyJump bastion

Now ssh db1 goes through the bastion automatically, and so do scp, rsync over SSH, Git and editors that use your SSH config. The ssh manual notes that options given on the command line usually apply to the destination, not the jump host, so settings for the bastion itself belong in this file.

The same config also handles SSH tunnels through the bastion. To open a private database port on your laptop:

ssh -L 5432:10.10.0.12:5432 bastion

Your local database tool then connects to localhost:5432, and the database server never needs a public port.

Agent forwarding: why ProxyJump is safer

Many older tutorials tell you to use ssh -A (agent forwarding) so that the bastion can use your keys to log in onward. The OpenSSH manual warns that this should be enabled with caution. Anyone who can bypass file permissions on the remote host, which means root on the bastion or an attacker who has become root, can use your forwarded agent socket. They cannot copy the key, but while you are connected they can authenticate as you to any server that trusts it.

A bastion is the one machine most likely to be attacked, so it is the worst place to expose your agent. Practical rules:

  • Use ProxyJump rather than -A. It needs no agent on the bastion at all.
  • Set ForwardAgent no for the bastion in ~/.ssh/config, which is also the default.
  • If you must forward an agent somewhere, add keys with ssh-add -c so each use asks you for confirmation.
  • Never store private keys on the bastion itself.

Hardening the bastion

Start from a minimal Linux install and follow the usual initial server setup, then go further. A sensible /etc/ssh/sshd_config for a bastion looks like this:

PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
PubkeyAuthentication yes
AllowUsers deploy alice
AllowAgentForwarding no
X11Forwarding no
PermitTunnel no
AllowTcpForwarding yes
LogLevel VERBOSE

Keep AllowTcpForwarding on, because ProxyJump depends on it, but switch off agent, X11 and tunnel-device forwarding. If you want to restrict where users can jump to, PermitOpen limits forwarding to listed destinations, for example PermitOpen 10.10.0.11:22 10.10.0.12:22 (list every destination users need, including any database port you tunnel to, such as 10.10.0.12:5432). For users who should only ever jump, never get a shell, a Match User block with ForceCommand /sbin/nologin still lets -J work while refusing interactive logins.

Other basics: install nothing else on the bastion (no web server, no database, no build tools), apply security updates promptly, and restrict who can reach port 22 on it. If your team works from fixed office IPs, allow only those in the firewall.

Keys and multi-factor authentication

Use SSH keys, not passwords. Ed25519 keys are short and fast; our guide to SSH keys shows how to create and install them. Give every person their own key so the logs can tell them apart, and never share one key across a team. NIST IR 7966 covers SSH key management in organisations, including the risk of keys that nobody tracks or removes.

For a second factor, sshd can require more than one method with AuthenticationMethods. Two common options:

  • Hardware-backed keys. OpenSSH supports FIDO2 security keys through the ed25519-sk key type, so the private key cannot be used without the physical token.
  • Key plus one-time code. AuthenticationMethods publickey,keyboard-interactive asks for a key and then a code from a PAM module such as a TOTP authenticator. This needs KbdInteractiveAuthentication yes and a configured PAM module, so test it carefully before you rely on it.

Logging

With LogLevel VERBOSE, sshd records the fingerprint of the key used for each login, which tells you which person connected, not only which account. Avoid DEBUG levels in production; the manual notes they violate users' privacy. Send the bastion's logs to another machine as well, because an attacker who gets in will try to clean the local copy. If you need full session recording for compliance, look at dedicated tools for that rather than shell history, which users can edit.

Locking SSH on internal servers to the bastion

A bastion only helps if the internal servers refuse SSH from everywhere else. On each internal server, allow port 22 from the bastion's private IP and nothing more. With ufw:

sudo ufw allow from 10.10.0.5 to any port 22 proto tcp
sudo ufw delete allow OpenSSH
sudo ufw status numbered
sudo ufw enable

The delete line matters if you followed our initial setup guide, which adds ufw allow OpenSSH: that earlier rule allows SSH from anywhere and ufw stops at the first matching rule, so a later deny would never be reached. Check ufw status numbered and remove any other rule that allows port 22 from anywhere; ufw already denies other incoming traffic by default.

Here 10.10.0.5 is the bastion's private address. You can go further and bind sshd to the private interface only with ListenAddress 10.10.0.12 in sshd_config, so it does not even listen on the public IP. Do the same in any provider-level firewall, so the rule holds even if the host firewall is reset.

Check from outside that it worked: from your laptop, ssh deploy@<public-ip-of-db1> should now time out, while ssh db1 through the bastion still works. If it does not, our SSH connection refused guide covers the usual causes.

Running a bastion on Bigdomainhost servers

A bastion needs very little: one vCPU-class workload, a small disk, and a fast private link to the servers it guards. On a Bigdomainhost KVM VPS, every server gets one public IPv4 address and a private interface within its region, and private traffic between your own servers in the same region is free and stays on the internal network. The networking docs also note that the default firewall policy denies inbound traffic except SSH on port 22, and you can edit firewall rules per server from the control panel.

The private network is per region, so put the bastion in the same region as the servers it serves: Mumbai (BOM-1) or Delhi NCR (DEL-1), both in Tier III facilities, as listed on our locations page. If you run servers in both regions, use one bastion in each. The smallest plan is usually enough for a bastion; servers are prepaid in 30-day periods from a rupee wallet.

Bastion host vs VPN vs session-manager tools

A bastion is not the only way to keep SSH off the public internet. The main options compare like this:

Ways to reach private servers compared
SSH bastionVPN (WireGuard, OpenVPN)Cloud session manager / identity-aware proxy
What you open to the internetSSH on one serverOne UDP or TCP port on the VPN serverNo public inbound port; an agent connects out (AWS), or only Google's IAP range may connect in (Google Cloud)
What users reachSSH and SSH tunnelsThe whole private network, any protocolShell sessions and forwarded ports, per policy
Software neededOpenSSH, already installedVPN client on every laptopThe provider's agent and CLI
Audit trailsshd logs on the bastionVPN connection logs; per-host logs for the restCentral session logs, often with recording
Works across providersYesYesUsually tied to one cloud
Best forSmall teams, Linux servers, SSH-only adminTeams that need databases, dashboards and SSH togetherLarge fleets already inside one cloud

WireGuard describes itself as a simple, fast, modern VPN. A common pattern is to run WireGuard on the bastion itself, so SSH is not exposed at all and staff connect to the VPN first. AWS Systems Manager Session Manager and Google Cloud IAP TCP forwarding keep SSH off the public internet by having an agent (AWS) or Google's proxy (IAP) broker the connection. AWS presents Session Manager as removing the need for open inbound ports and bastion hosts, and Google's IAP lets you reach VMs that have no external IP address. They work well inside those clouds but do not cover servers elsewhere.

For a handful of Linux servers, a well-hardened bastion with ProxyJump is often the simplest option that gives you a real audit trail, and it uses nothing beyond OpenSSH. If you would rather someone else handled this kind of hardening, compare managed and unmanaged VPS options first.

Questions about private networking between your servers? Message us on WhatsApp at +91 75994 50220 at any time, call during IST working hours, or email support@bigdomainhost.com.

Bigdomainhost wrote this guide with AI assistance and sells the VPS servers it describes. OpenSSH options were checked against the OpenBSD manual pages on 27 November 2026; defaults can change between OpenSSH versions, so check man ssh_config and man sshd_config on your own system.

Sources (checked )

Answers

Frequently asked questions

Still unsure? Call +91 75994 50220 or write to support@bigdomainhost.com — a human replies in IST hours.

What is a bastion host in simple terms?

A bastion host is the one server in your setup that accepts logins from the internet. Your other servers only accept SSH from the bastion over a private network. You log in to the bastion first and hop from there, so only one machine needs to face attackers, and it is hardened and logged closely.

Is a bastion host the same as a jump server?

In practice, yes. Bastion host, jump server, jump host and jump box all describe a hardened server you pass through to reach private machines. Some people use bastion for the hardened security role and jump server for the hop itself, but the setup is the same.

What does ssh -J do?

ssh -J connects to a jump host first, asks it to forward a TCP connection to the target, then runs a separate encrypted SSH session to the target through that connection. It is the command-line form of the ProxyJump option, added in OpenSSH 7.3. Your private key stays on your own computer.

Is SSH agent forwarding safe on a bastion?

It is best avoided. The OpenSSH manual warns that anyone who can bypass file permissions on the remote host can use a forwarded agent to authenticate as you while you are connected. Use ProxyJump instead, which needs no agent on the bastion, and keep ForwardAgent set to no.

Do I still need a bastion if I use a VPN?

Not always. A VPN such as WireGuard already keeps SSH off the public internet, and many teams run the VPN on the bastion itself. A bastion still helps if you want one place that logs every SSH session, or if some users should reach servers over SSH only, not the whole network.

How big does a bastion server need to be?

Small. A bastion only relays SSH sessions, so it needs little CPU, memory or disk. The smallest VPS plan is usually enough. What matters more is that it sits in the same region as the servers it guards, so it can reach them over the private network.

Support that picks up the phone.

In IST hours, in Hindi or English, and WhatsApp replies fastest at any time. Sales, migration and emergencies all reach the same engineers. No offshore queue, no 48-hour first reply.

Need cPanel or WHM with the ports already sorted?

Web & cPanel hosting comes with cPanel ready to log in to, reseller hosting adds white-label WHM, and a KVM VPS can have cPanel & WHM pre-installed. Call +91 75994 50220 or email support@bigdomainhost.com.