Quick answer: connect through a jump host
When a private SSH server is reachable from a bastion but not directly from your workstation, OpenSSH can connect through that bastion with -J (also called ProxyJump). The second SSH authentication happens end-to-end between your local client and the destination; no private key needs to be copied onto the bastion.
ssh -J [email protected] [email protected]For a nonstandard jump-host port, use [email protected]:2222 after -J. A different destination port uses -p on the destination connection:
ssh -J [email protected]:2222 -p 2200 [email protected]Your workstation must reach the bastion, and the bastion must reach the target SSH port. The bastion SSH daemon must also permit TCP forwarding for that connection. ProxyJump does not bypass firewall rules or authentication.
1. How ProxyJump works
The local OpenSSH client authenticates to the bastion and requests a direct-tcpip forwarding channel to the destination. It then performs a separate SSH handshake with the destination over that channel, including destination host-key verification and user authentication. The bastion sees the destination address/port and can observe connection metadata, but cannot decrypt a correctly verified destination SSH session.
This is not the same as logging into a bastion and running a second ssh command there. With -J, the target credential remains on the workstation. Agent forwarding (-A) is not required.
2. Reachability and private DNS
Before debugging keys, verify the network path. The client needs access to the bastion SSH listener; the bastion needs access to the target TCP port. The client does not need a direct route to the target.
ssh -v [email protected]
# Once authorized on the bastion, check its connection to the private host:
nc -vz 10.10.0.20 22Private DNS nuance: for the usual ProxyJump/ssh -W forwarding path, the destination TCP hostname is resolved on the final jump host. So a name only known to the bastion can still work even if your laptop cannot resolve it. Your local client still interprets Host/HostName configuration and checks the destination host key. Troubleshoot those separately.
Verified in our isolated Docker test: sshflow-jump-client resolved jump-bastion to 172.23.0.3, but could not resolve jump-target. A direct TCP connection to target 172.24.0.3:22 timed out after a three-second test. From the bastion, connecting to jump-target:22 succeeded. These results verify the isolation of this lab configuration; they do not describe all Docker or cloud network configurations.
3. One-off connection with ssh -J
The simplest command needs a reachable jump host and working credentials for both hops:
ssh -v -J [email protected] [email protected]The verbose output should show the proxy/forward command, authentication to the jump host, then a separate authentication and host-key check for the destination. On failure, record which host rejected the connection; timing alone does not identify the failing hop.
Different private keys? A destination -i option is not generally inherited by the jump-host SSH subprocess. Configure the bastion identity in its own Host stanza (next section) instead of assuming one command-line key applies to both hops.
Observed output from our lab: with ssh -v -J jump-bastion jump-target, OpenSSH invoked ssh -v -W '[jump-target]:22' jump-bastion, successfully authenticated to both hosts using public keys, and ran whoami / hostname on the private destination. The command exited with status 0.
Authenticated to jump-bastion ([172.23.0.3]:22) using "publickey".
Authenticated to jump-target (via proxy) using "publickey".
PASS: Connected to private target through SSH jump host
targetuser
jump-target
SSH exit code: 0
4. Permanent ProxyJump config: different users, ports and keys
Keep each host identity explicit in ~/.ssh/config. The first block describes the bastion; the second describes the private destination. The address below is documentation-only and must be replaced with the real private address.
Host bastion
HostName 203.0.113.10
User ops
Port 2222
IdentityFile ~/.ssh/bastion_key
IdentitiesOnly yes
ForwardAgent no
Host db-server
HostName 10.0.4.15
User deploy
Port 22
IdentityFile ~/.ssh/db_key
IdentitiesOnly yes
ProxyJump bastionssh db-server
# Inspect each effective identity and destination proxy:
ssh -G bastion | grep -E '^(user|hostname|port|identityfile|identitiesonly) '
ssh -G db-server | grep -E '^(user|hostname|port|identityfile|identitiesonly|proxyjump) 'IdentitiesOnly yes restricts agent key offers to configured identities, but IdentityFile directives may accumulate through overlapping Host blocks and Include files. Run ssh -G if more keys are offered than expected. See the Too Many Authentication Failures guide.
Validated per-hop identities: our ssh -G output selected /root/.ssh/sshflow_jump_bastion_key for jumpuser and /root/.ssh/sshflow_jump_target_key for targetuser. The distinct ED25519 fingerprints below also appeared on the respective Offering public key lines in ssh -v, confirming that the intended key was actually presented at each hop.
Bastion: SHA256:BGr/8duOW1cq3GvjANUyKtal0yClFNJx8f6K3oRHf+I
Target: SHA256:Tq6frNPRsykKySqe0VA/8ls8fStp8dWuLia0JLJgz9s
ssh -G jump-target → proxyjump jump-bastion
ssh jump-target → Authenticated to both hosts
-J flag. Full-size image.5. Multiple jump hosts
You can list multiple bastions in order. For example, the first hop is reachable from the workstation, the second is reachable from the first, and the destination is reachable from the second:
ssh -J ops@public-bastion,admin@second-hop deploy@private-targetFor repeatable setups, give every hop its own SSH config entry and put the ordered, comma-separated route on the final target. This makes the two intermediate hosts explicit rather than relying on an implicit nested ProxyJump chain. The multi-hop example below is a documented configuration pattern, not a separate result from our two-hop lab.
Host public-bastion
HostName bastion.example.com
User ops
IdentityFile ~/.ssh/public_bastion_key
Host second-hop
HostName 10.20.0.10
User admin
IdentityFile ~/.ssh/second_hop_key
Host private-target
HostName 10.30.0.10
User deploy
IdentityFile ~/.ssh/private_target_key
ProxyJump public-bastion,second-hop
# Connect using the final alias:
ssh private-targetFor one-off routes, comma-separated -J hops are usually easiest to audit. Each host must have its own usable credentials and forwarding policy.
6. ProxyJump vs. ProxyCommand
OpenSSH 7.3 introduced -J/ProxyJump as a simpler way to forward through one or more SSH servers. The older equivalent uses ProxyCommand and ssh -W:
Host db-server
HostName 10.0.4.15
User deploy
ProxyCommand ssh -W %h:%p bastionPrecedence matters: ProxyJump and ProxyCommand compete; the first value OpenSSH accepts prevents the later one from taking effect. In inherited configurations, use ssh -G to see what really applies. Prefer ProxyJump for ordinary SSH bastions; retain ProxyCommand when a custom transport, non-SSH proxy or older compatible client requires it.
7. Why AllowTcpForwarding can block -J
Although no extra jump-host application is needed, sshd must permit the forwarding channel. On the bastion, AllowTcpForwarding no, DisableForwarding yes, a restrictive PermitOpen rule or a key-specific forwarding restriction can block the request.
# Diagnostic command used in our isolated test:
ssh -vvv -o BatchMode=yes jump-targetThe characteristic error is channel ... open failed: administratively prohibited, often followed by stdio forwarding failed. The error identifies a forwarding-policy failure; it does not prove a bad SSH password or private key.
For a controlled server that should forward only to a particular target, a more selective example is:
# Bastion sshd_config: configuration directives, NOT shell commands
AllowTcpForwarding yes
PermitOpen 10.0.4.15:22
AllowAgentForwarding noSecurity boundary: PermitOpen matches the requested destination hostname/IP and port; it is not a complete isolation boundary for an account that also has unrestricted shell access. Review the bastion account restrictions, network firewall and effective Match rules. Never change these settings on a production bastion just to make a screenshot.
Reproduced failure and recovery: we temporarily set AllowTcpForwarding no in a disposable bastion container, reloaded its sshd, and retried the same target connection. The attempt failed with the exact forwarding error below. After removing the temporary override and reloading sshd, both authentication steps succeeded and the private destination responded again.
channel 0: open failed: administratively prohibited: open failed
stdio forwarding failed
# After restoring TCP forwarding:
Authenticated to jump-bastion ([172.23.0.3]:22) using "publickey".
Authenticated to jump-target (via proxy) using "publickey".
PASS: ProxyJump restored
targetuser
jump-target
AllowTcpForwarding no restriction caused the failure; removing that lab-only restriction restored access. Full-size image.8. Why agent forwarding is unnecessary
A ProxyJump SSH client signs the destination authentication locally, over a forwarded TCP channel. You do not need ssh -A or ForwardAgent yes for this setup. Copying private keys onto the bastion is unnecessary and increases exposure.
Agent forwarding is a different feature: it makes a local agent available to processes on the remote host, which can request signatures while the forwarded agent is accessible. Leave it disabled unless the job truly needs an SSH client running on the bastion.
Host bastion
ForwardAgent noThe bastion does learn the destination TCP endpoint and traffic metadata even when the inner SSH session remains encrypted. Securely verify both host keys instead of assuming an intermediary is invisible or trusted.
9. SCP and SFTP through the jump host
For modern OpenSSH clients, scp and sftp can use jump hosts. Explicitly connect the file-transfer client to the destination, not the bastion; the latter is only the forwarding path.
scp -J [email protected] ./report.txt [email protected]:/tmp/report.txt
sftp -J [email protected] [email protected]If you already created a ProxyJump alias in your SSH config, the transfer can simply use that alias:
scp ./report.txt db-server:/tmp/report.txtVerified file transfer: we copied a disposable text file using scp to jump-target:/home/targetuser/sshflow-jump-proof.txt using the existing ProxyJump config. The verbose transfer log showed separate public-key authentication to both hops and Sending subsystem: sftp. This is expected for modern OpenSSH: scp uses SFTP as its default transfer protocol, even though the command is named scp.
The sha256sum result matched exactly on the client and target, confirming the transferred file's contents matched in this test:
Authenticated to jump-bastion ([172.23.0.3]:22) using "publickey".
Authenticated to jump-target (via proxy) using "publickey".
debug1: Sending subsystem: sftp
SHA-256 (client):
6268c8a45720e21c20be61e891f53b6b50ec2c57e18e674d12240a363b285177
SHA-256 (target):
6268c8a45720e21c20be61e891f53b6b50ec2c57e18e674d12240a363b285177
PASS: SCP transfer successful; SHA-256 checksums match
10. Use -L with a jump host
You can also forward a local TCP port through the completed SSH connection. This example reaches a database listener bound to loopback on the final destination:
ssh -N -J [email protected] \
-L 15432:127.0.0.1:5432 [email protected]While this SSH session is open, connecting to 127.0.0.1:15432 on your workstation is forwarded to 127.0.0.1:5432 from the destination server’s perspective. Do not confuse the destination loopback address with the bastion loopback. Verify the actual service is running and authorized before using a tunnel.
11. Troubleshoot the failing hop
| Error / symptom | What it suggests | Next action |
|---|---|---|
Permission denied (publickey) | Could be either hop; inspect ssh -vv for the hostname being authenticated | Verify that host’s username and IdentityFile |
administratively prohibited | Jump host denies direct TCP forwarding | Check AllowTcpForwarding, PermitOpen, DisableForwarding, key options |
Could not resolve hostname | Identify whether bastion or local client is looking up the name | Run the corresponding resolver test on each host |
Connection timed out | Client→bastion or bastion→target path blocked | Test each TCP path separately |
REMOTE HOST IDENTIFICATION HAS CHANGED | Host-key verification failed on one hop | Verify fingerprint out of band; don’t disable checks |
UNKNOWN port 65535 | Generic forwarded/stdio failure symptom | Read earlier ssh -vvv errors to find the actual cause |
Too many authentication failures | Too many rejected authentication attempts on a hop | Use ssh -G and IdentitiesOnly yes per host |
Useful read-only checks on the client:
ssh -V
ssh -G db-server | grep -E '^(hostname|user|port|proxyjump|proxycommand|identityfile|identitiesonly) '
ssh -vvv db-serverOn an authorized bastion administrator account, validate sshd configuration before changing anything:
sudo sshd -t
sudo sshd -T | grep -E '^(allowtcpforwarding|disableforwarding|permitopen|allowagentforwarding) '12. Jump-host security checklist
- Keep the destination private: allow its SSH listener only from approved bastions or network segments, not from the public Internet.
- Verify both host keys: do not hide host-key mismatches using
StrictHostKeyChecking no. - Use distinct least-privilege accounts and keys: define each host’s SSH identity; avoid copying private keys to the bastion.
- Restrict forwarding: apply effective
AllowTcpForwarding,PermitOpen, key restrictions and firewall rules intentionally. - Harden and monitor the bastion: patch it, log connections and limit who can authenticate.
- Avoid unnecessary agent forwarding:
ssh -Jdoes not need-A.
A bastion does not automatically provide comprehensive access control or audit of commands run inside the end-to-end encrypted destination SSH session. That requires separate controls and logging on the target.
OpenSSH lab: original test evidence and limitations
Testing provenance: The Docker lab and screenshots below were recorded for ShadeTerm before the product was renamed ShadeTerm. Original test hostnames, filenames and screenshot contents are preserved. These results demonstrate OpenSSH CLI behavior, not a new test of ShadeTerm’s jump-host implementation.
Experiment status: completed November 7, 2026. We ran the following checks with three Debian Bookworm Docker containers, using two Docker networks so that the client could reach the bastion but not the private target directly. These are user-executed commands with collected terminal output, not synthetic screenshots or a claim that production infrastructure was tested.
- Network isolation — passed. The client resolved the bastion at
172.23.0.3, but could not resolve the private hostname or establish a direct TCP connection to172.24.0.3:22. The bastion reached the target at172.24.0.3:22. - One-off
ssh -J— passed. OpenSSH authenticated to the bastion asjumpuserand to the private destination astargetuser. The remote hostname wasjump-target, and the SSH exit code was0. - Separate per-hop ED25519 keys — passed. Fingerprints from
ssh-keygen -lfmatched the different keys actually offered inssh -v.ssh -Gshowed the effectiveIdentityFileandProxyJumpentries. - Forwarding policy failure/recovery — passed. Disabling
AllowTcpForwardingon the disposable bastion causedadministratively prohibited/stdio forwarding failed. Restoring forwarding allowed authentication to both hops and access to the destination again. - SCP through the bastion — passed. The log showed
Sending subsystem: sftp; the copied file had matching SHA-256 values at source and destination:6268c8a45720e21c20be61e891f53b6b50ec2c57e18e674d12240a363b285177.
What the lab does not prove: this was not a test of cloud firewall/security-group products, Turris firmware, PuTTY/Pageant, agent forwarding under compromise, or ShadeTerm application's own ProxyJump implementation. The OpenSSH CLI examples and observations should not be represented as a product-compatibility test of ShadeTerm until that application is independently tested.
Scope of verification: the lab operator ran the commands in disposable Docker containers and shared the terminal outputs recorded in this guide. Those outputs substantiate the five specific observations above. They are not a benchmark, a penetration test, or a test of the ShadeTerm desktop client. The image files are linked to their matching results so readers can inspect the original terminal captures.
Frequently asked questions
Can SSH -J use different keys for the bastion and destination?
Yes. Put each host in its own SSH config block with its own IdentityFile and IdentitiesOnly yes. Command-line -i for the destination is not a substitute for a bastion-specific entry.
Does the destination need a public IP?
No. The bastion must reach the destination on its SSH port; the workstation needs only the bastion route.
Does a private hostname have to resolve on my computer?
Not for the standard remote forwarding TCP connection. The final jump host performs the destination TCP lookup, while your local OpenSSH client still uses host aliases and host-key configuration.
Does ProxyJump require agent forwarding?
No. Your local SSH client authenticates separately to the destination through the forwarding channel.
Is ProxyJump safer than opening SSH on every internal host?
It can reduce direct exposure when paired with real firewall segmentation, least-privilege accounts and bastion hardening. ProxyJump alone is not a security boundary.
Does ShadeTerm automatically support ProxyJump?
This article tests the OpenSSH command-line client, not ShadeTerm’s application transport. Verify supported jump-host workflows in the current app and documentation before relying on a particular configuration.
Technical references and further reading
- OpenSSH ssh_config(5): ProxyJump, IdentityFile, ProxyCommand, IdentitiesOnly
- OpenSSH sshd_config(5): AllowTcpForwarding, PermitOpen, DisableForwarding
- OpenSSH ssh(1): -J, -W, -L and verbose diagnostics
- OpenSSH scp(1): SFTP-default transfers and -J support
- Gentoo Wiki: single and multi-hop SSH jump configurations
- Pinggy: jump hosts, file transfers, tunnels and troubleshooting
OpenSSH manual pages are the primary technical references for protocol behavior and configuration. The Gentoo Wiki and Pinggy guide provide complementary examples; the Docker outputs above are our independent, narrowly scoped practical checks.
Conclusion
For a one-off private-server connection, use ssh -J jumpuser@bastion targetuser@private-target. For repeat use, create two host-specific SSH config blocks with distinct credentials and ProxyJump bastion. Verify remote reachability, host keys and the bastion’s TCP forwarding policy before troubleshooting target credentials.
Need an organized desktop workspace for SSH, SFTP and code? Explore ShadeTerm. These OpenSSH commands describe the CLI behavior; desktop jump-host compatibility should be independently tested before making a product-specific claim.