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

Quick Linux Tip #57:

Question: 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. This lets you reach an internal server through multiple intermediate SSH hosts without manually opening nested SSH sessions.

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: -J is the command-line equivalent of ProxyJump in ~/.ssh/config. It is cleaner than nested ssh -t sessions and avoids the need for SSH agent forwarding in many jump-host setups. Make sure your SSH keys and access permissions are configured for the required hosts.




LinuxTeck.com
linuxteck@ubuntu:~$ ssh -J linuxteck@bastion,linuxteck@jumphost linuxteck@internal-server
Welcome to Ubuntu 24.04 LTS (GNU/Linux 6.8.0-generic x86_64)

  System load:  0.15                 Processes:              123
  Usage of /:   34.5% of 100.00GB   Users logged in:        0
  Memory usage: 45%                  IPv4 address:           10.0.0.50

Last login: Sat Aug 02 09:15:23 2026 from bastion.internal
linuxteck@internal-server:~$

PREVIOUS ARTICLE Quick Linux Tip #56 - My SSD Is Wearing Out. Which Process Is Writing the Most? NEXT ARTICLE Quick Linux Tip #58 - How to Profile Memory Usage in a Bash Script
About John Britto

John Britto Founder & Chief-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 20+ years of experience in Linux and Open Source technologies.

View all posts by John Britto →

Leave a Reply

Your email address will not be published.