LinuxXXVI · SSHProxyJump
ProxyJump and jump hosts - secure access patterns
What you'll learn
- Use ProxyJump for bastion access
- Combine ProxyJump with port forwarding
- Distinguish ProxyJump from agent forwarding
- Configure ~/.ssh/config for complex topologies
Prerequisites
Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09
ProxyJump (introduced in OpenSSH 7.3) is the modern,
secure way to use an intermediate SSH host as a bastion.
It replaces the older ssh -tt chains and provides a
cleaner, more controllable pattern.
How ProxyJump works
ProxyJump makes an intermediate SSH connection and then opens a direct-tcpip channel from the operator’s local host through the intermediate to the final target. The intermediate does not see the final session; it is a TCP forward.
operator --ssh(1)--> bastion --tcp forward--> production
|
+-- ssh(2) channel inside ssh(1)
The operator has one SSH session (to the bastion), but the final connection to production goes through that session.
Basic usage
ssh -J bastion.example.com user@production-1
-J is the ProxyJump option. The bastion is logged into
first; the production login happens through the bastion’s
connection.
Multiple hops
ssh -J bastion1,bastion2 user@production
Comma-separated hops. Each bastion logs in sequentially, and the production login happens at the end.
~/.ssh/config
Host bastion
HostName bastion.example.com
User jumpuser
IdentityFile ~/.ssh/bastion_key
Host prod-*
User admin
IdentityFile ~/.ssh/prod_key
ProxyJump bastion
Now:
ssh prod-1 # automatically goes through bastion
ssh prod-2 # same
scp file prod-3:/tmp/ # SCP also works
Combine with port forwarding
ProxyJump works alongside local and remote port forwarding:
ssh -J bastion -L 8080:internal-db:5432 user@production
This opens a local listener on port 8080 that, through the bastion and the production host, reaches an internal database. Useful for accessing services that are not directly reachable.
Multiple ssh sessions
Each ssh command opens its own connection through the
bastion. If you need multiple sessions to the same host
(SSH multiplexing):
Host prod-*
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 10m
After the first connection, additional sessions reuse the existing connection. Faster, less load on the bastion.
ProxyJump vs agent forwarding
ProxyJump is strictly better than agent forwarding for the “reach a host through a bastion” pattern:
| Feature | ProxyJump | Agent forwarding |
|---|---|---|
| Server sees your keys | No | Yes (if compromised) |
| Works with bastion only | Yes | No |
| Works with ProxyCommand chain | Yes | Yes |
| Performance | One TCP forward | Multiple TCP forwards |
Use ProxyJump for bastion access. Reserve agent forwarding for cases where the bastion must use your keys (e.g. a specific key is required on the production host).
ProxyCommand (older alternative)
Before ProxyJump, the pattern was:
Host prod-1
ProxyCommand ssh bastion -W %h:%p
ProxyCommand runs an arbitrary command to establish the
connection. -W %h:%p runs an SSH-level forward.
ProxyJump is essentially ProxyCommand ssh -W %h:%p. Use
ProxyJump for new configs; ProxyCommand only when you need
the flexibility.
Combined with SSH tunnels
ssh -J bastion -L 2222:target-internal:22 user@production
This sets up a tunnel that lets you:
ssh -p 2222 localhost
reach an internal host from your local machine.
Knowledge check
Knowledge check · 3 questions
Q1. What is the modern way to reach a host through a bastion?
Q2. With ProxyJump, the target host authenticates you directly and your private key never has to be usable on the bastion.
Q3. Which of the following are valid SSH config ProxyJump entries? Select all that apply.
Passing score: 75%. Answers are checked in this browser.