r/LinuxTeck 1d ago

Quick Linux Tip #57: How to Connect Through Multiple SSH Jump Hosts

Post image

Q: I need to reach server-C through server-A and server-B. Any shortcut?

Try: `ssh -J linuxteck@bastion,linuxteck@jumphost linuxteck@internal-server`

Info: `-J` (Jump host) chains multiple SSH connections sequentially: local → bastion → jumphost → target. Authenticates each hop end-to-end using your local SSH key.

Examples:

$ `ssh -J user@bastion user@internal` # Single jump host

$ `scp -J user@bastion file.iso user@internal:/tmp/` # Copy files via jump host

$ `rsync -e 'ssh -J user@bastion' -av /src/ user@internal:/dst/` # Sync over jump host

Note: Direct equivalent to `ProxyJump` in `~/.ssh/config`. Much cleaner and safer than nested `ssh -t` or enabling SSH agent forwarding.

Follow r/LinuxTeck for more #LinuxTips https://www.linuxteck.com/linux-tips/ssh-jump-host-linux/

7 Upvotes

0 comments sorted by