Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

60%
+1 −0
Q&A How to forward SSH access of one machine, through another, to the rest of a network?

Grove's answer is likewise good, but OpenSSH introduced ProxyJump (-J) in 2016 with v7.3, making it even easier to chain SSH hosts together: ssh -J user@interstitial.example me@destination.example...

posted 1y ago by Michael‭  ·  edited 10mo ago by Michael‭

Answer
#9: Post edited by user avatar Michael‭ · 2024-02-14T20:46:03Z (10 months ago)
Yet more ASCII chart tweaking
  • [Grove's answer][grove] is likewise good, but OpenSSH introduced `ProxyJump` (`-J`) in 2016 [with v7.3][openssh-7.3], making it even easier to chain SSH hosts together:
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • "Real" port forwarding like [Canina's answer][canina] still has important uses,[^1] but chaining SSH hops doesn't have to be done that way.
  • ## Permanent config
  • Since access for most people doesn't change very often, it's nice to keep the details on disk. You can set them up in _~/.ssh/config_ like this:
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not the default 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • If multiple hops are required to reach the destination, just add an entry for each of them in _~/.ssh/config_ with a `ProxyJump` for the previous hop. You can also do multiple hops with `-J` by comma-separating them.
  • ## Diagram
  • It's worth noting that all the SSH sessions with `ProxyJump` are direct from _your_ computer to each remote computer, no matter how many hops it takes. Tunnels are nested, not link-to-link. You don't need to forward your SSH agent.
  • ```
  • +-----+______________________________+--------------+ +-------------+
  • | |=========nested=tunnel=to=destination===========| |
  • | |__ __| | | |
  • | You | \ tunnel to interstitial / | Interstitial | | Destination |
  • +-----+ \______________________/ +--------------+ +-------------+
  • ```
  • [^1]: If you want local access to non-SSH resources available from the destination, you can do that. Add a `LocalForward` option on the destination server's config, which will bring them through the tunnel back to your local computer.
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [canina]: https://linux.codidact.com/posts/282493/282494#answer-282494
  • [Grove's answer][grove] is likewise good, but OpenSSH introduced `ProxyJump` (`-J`) in 2016 [with v7.3][openssh-7.3], making it even easier to chain SSH hosts together:
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • "Real" port forwarding like [Canina's answer][canina] still has important uses,[^1] but chaining SSH hops doesn't have to be done that way.
  • ## Permanent config
  • Since access for most people doesn't change very often, it's nice to keep the details on disk. You can set them up in _~/.ssh/config_ like this:
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not the default 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • If multiple hops are required to reach the destination, just add an entry for each of them in _~/.ssh/config_ with a `ProxyJump` for the previous hop. You can also do multiple hops with `-J` by comma-separating them.
  • ## Diagram
  • It's worth noting that all the SSH sessions with `ProxyJump` are direct from _your_ computer to each remote computer, no matter how many hops it takes. Tunnels are nested, not link-to-link. You don't need to forward your SSH agent.
  • ```
  • +-------+ .-----------. +----------------+ +---------------+
  • | |__/ tunnel to \__| | | |
  • | You | interstitial | Interstitial | | Destination |
  • | |========================================| |
  • | | nested tunnel to destination | |
  • | |========================================| |
  • | |-------------------| | | |
  • +-------+ +----------------+ +---------------+
  • ```
  • [^1]: If you want local access to non-SSH resources available from the destination, you can do that. Add a `LocalForward` option on the destination server's config, which will bring them through the tunnel back to your local computer.
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [canina]: https://linux.codidact.com/posts/282493/282494#answer-282494
#8: Post edited by user avatar Michael‭ · 2024-02-14T20:16:35Z (10 months ago)
Better ascii art
  • [Grove's answer][grove] is likewise good, but OpenSSH introduced `ProxyJump` (`-J`) in 2016 [with v7.3][openssh-7.3], making it even easier to chain SSH hosts together:
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • "Real" port forwarding like [Canina's answer][canina] still has important uses,[^1] but chaining SSH hops doesn't have to be done that way.
  • ## Permanent config
  • Since access for most people doesn't change very often, it's nice to keep the details on disk. You can set them up in _~/.ssh/config_ like this:
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not the default 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • If multiple hops are required to reach the destination, just add an entry for each of them in _~/.ssh/config_ with a `ProxyJump` for the previous hop. You can also do multiple hops with `-J` by comma-separating them.
  • ## Diagram
  • It's worth noting that all the SSH sessions with `ProxyJump` are direct from _your_ computer to each remote computer, no matter how many hops it takes. Tunnels are nested, not link-to-link. You don't need to forward your SSH agent.
  • ```
  • +-----+ .-------------------------. +--------------+ +-------------+
  • | You |<=========nested=tunnel=to=destination=========>| Destination |
  • +-----+ \ tunnel to interstitial >| Interstitial | +-------------+
  • `-------------------------` +--------------+
  • ```
  • [^1]: If you want local access to non-SSH resources available from the destination, you can do that. Add a `LocalForward` option on the destination server's config, which will bring them through the tunnel back to your local computer.
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [canina]: https://linux.codidact.com/posts/282493/282494#answer-282494
  • [Grove's answer][grove] is likewise good, but OpenSSH introduced `ProxyJump` (`-J`) in 2016 [with v7.3][openssh-7.3], making it even easier to chain SSH hosts together:
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • "Real" port forwarding like [Canina's answer][canina] still has important uses,[^1] but chaining SSH hops doesn't have to be done that way.
  • ## Permanent config
  • Since access for most people doesn't change very often, it's nice to keep the details on disk. You can set them up in _~/.ssh/config_ like this:
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not the default 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • If multiple hops are required to reach the destination, just add an entry for each of them in _~/.ssh/config_ with a `ProxyJump` for the previous hop. You can also do multiple hops with `-J` by comma-separating them.
  • ## Diagram
  • It's worth noting that all the SSH sessions with `ProxyJump` are direct from _your_ computer to each remote computer, no matter how many hops it takes. Tunnels are nested, not link-to-link. You don't need to forward your SSH agent.
  • ```
  • +-----+______________________________+--------------+ +-------------+
  • | |=========nested=tunnel=to=destination===========| |
  • | |__ __| | | |
  • | You | \ tunnel to interstitial / | Interstitial | | Destination |
  • +-----+ \______________________/ +--------------+ +-------------+
  • ```
  • [^1]: If you want local access to non-SSH resources available from the destination, you can do that. Add a `LocalForward` option on the destination server's config, which will bring them through the tunnel back to your local computer.
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [canina]: https://linux.codidact.com/posts/282493/282494#answer-282494
#7: Post edited by user avatar Michael‭ · 2024-01-05T20:07:39Z (11 months ago)
Diagram
  • [Grove's answer][grove] is likewise good, but OpenSSH introduced `ProxyJump` (`-J`) in 2016 [with v7.3][openssh-7.3], making it even easier to chain SSH hosts together:
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • Since access for most people doesn't change very often, it's nice to keep the details on disk. You can set them up in _~/.ssh/config_ like this:
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not the default 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • If multiple hops are required to reach the destination, just add an entry for each of them in _~/.ssh/config_ with a `ProxyJump` for the previous hop. You can also do multiple hops with `-J` by comma-separating them.
  • "Real" port forwarding like [Canina's answer][canina] still has important uses,[^1] but chaining SSH hops doesn't have to be done that way.
  • [^1]: If you want local access to non-SSH resources available from the destination, you can do that. Add a `LocalForward` option on the destination server's config, which will bring them through the tunnel back to your local computer.
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [canina]: https://linux.codidact.com/posts/282493/282494#answer-282494
  • [Grove's answer][grove] is likewise good, but OpenSSH introduced `ProxyJump` (`-J`) in 2016 [with v7.3][openssh-7.3], making it even easier to chain SSH hosts together:
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • "Real" port forwarding like [Canina's answer][canina] still has important uses,[^1] but chaining SSH hops doesn't have to be done that way.
  • ## Permanent config
  • Since access for most people doesn't change very often, it's nice to keep the details on disk. You can set them up in _~/.ssh/config_ like this:
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not the default 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • If multiple hops are required to reach the destination, just add an entry for each of them in _~/.ssh/config_ with a `ProxyJump` for the previous hop. You can also do multiple hops with `-J` by comma-separating them.
  • ## Diagram
  • It's worth noting that all the SSH sessions with `ProxyJump` are direct from _your_ computer to each remote computer, no matter how many hops it takes. Tunnels are nested, not link-to-link. You don't need to forward your SSH agent.
  • ```
  • +-----+ .-------------------------. +--------------+ +-------------+
  • | You |<=========nested=tunnel=to=destination=========>| Destination |
  • +-----+ \ tunnel to interstitial >| Interstitial | +-------------+
  • `-------------------------` +--------------+
  • ```
  • [^1]: If you want local access to non-SSH resources available from the destination, you can do that. Add a `LocalForward` option on the destination server's config, which will bring them through the tunnel back to your local computer.
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [canina]: https://linux.codidact.com/posts/282493/282494#answer-282494
#6: Post edited by user avatar Michael‭ · 2023-10-25T18:58:15Z (about 1 year ago)
Workshop the first sentence some more.
  • [Grove's answer][grove] is likewise good, but OpenSSH made it even easier to chain SSH hosts together with `ProxyJump` (`-J`), since 2016 when it was [introduced in v7.3][openssh-7.3].
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • Since access for most people doesn't change very often, it's nice to keep the details on disk. You can set them up in _~/.ssh/config_ like this:
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not the default 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • If multiple hops are required to reach the destination, just add an entry for each of them in _~/.ssh/config_ with a `ProxyJump` for the previous hop. You can also do multiple hops with `-J` by comma-separating them.
  • "Real" port forwarding like [Canina's answer][canina] still has important uses,[^1] but chaining SSH hops doesn't have to be done that way.
  • [^1]: If you want local access to non-SSH resources available from the destination, you can do that. Add a `LocalForward` option on the destination server's config, which will bring them through the tunnel back to your local computer.
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [canina]: https://linux.codidact.com/posts/282493/282494#answer-282494
  • [Grove's answer][grove] is likewise good, but OpenSSH introduced `ProxyJump` (`-J`) in 2016 [with v7.3][openssh-7.3], making it even easier to chain SSH hosts together:
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • Since access for most people doesn't change very often, it's nice to keep the details on disk. You can set them up in _~/.ssh/config_ like this:
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not the default 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • If multiple hops are required to reach the destination, just add an entry for each of them in _~/.ssh/config_ with a `ProxyJump` for the previous hop. You can also do multiple hops with `-J` by comma-separating them.
  • "Real" port forwarding like [Canina's answer][canina] still has important uses,[^1] but chaining SSH hops doesn't have to be done that way.
  • [^1]: If you want local access to non-SSH resources available from the destination, you can do that. Add a `LocalForward` option on the destination server's config, which will bring them through the tunnel back to your local computer.
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [canina]: https://linux.codidact.com/posts/282493/282494#answer-282494
#5: Post edited by user avatar Michael‭ · 2023-10-25T16:49:53Z (about 1 year ago)
Mention port forwarding, in case it's important to someone.
  • [Grove's answer][grove] is likewise good, but OpenSSH made it even easier to chain hosts together with `ProxyJump` (`-J`), introduced in [v7.3][openssh-7.3] in 2016. It's _so easy_ now.
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • Or set them up in _~/.ssh/config_ like this
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • If multiple hops are required to reach the destination, just add an entry for each of them in _~/.ssh/config_ with a `ProxyJump` for the previous hop. You can also do multiple hops with `-J` by comma-separating them.
  • Port forwarding like [Canina's answer][canina] still has important uses, but chaining SSH hops doesn't have to be done that way.
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [canina]: https://linux.codidact.com/posts/282493/282494#answer-282494
  • [Grove's answer][grove] is likewise good, but OpenSSH made it even easier to chain SSH hosts together with `ProxyJump` (`-J`), since 2016 when it was [introduced in v7.3][openssh-7.3].
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • Since access for most people doesn't change very often, it's nice to keep the details on disk. You can set them up in _~/.ssh/config_ like this:
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not the default 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • If multiple hops are required to reach the destination, just add an entry for each of them in _~/.ssh/config_ with a `ProxyJump` for the previous hop. You can also do multiple hops with `-J` by comma-separating them.
  • "Real" port forwarding like [Canina's answer][canina] still has important uses,[^1] but chaining SSH hops doesn't have to be done that way.
  • [^1]: If you want local access to non-SSH resources available from the destination, you can do that. Add a `LocalForward` option on the destination server's config, which will bring them through the tunnel back to your local computer.
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [canina]: https://linux.codidact.com/posts/282493/282494#answer-282494
#4: Post edited by user avatar Michael‭ · 2023-10-25T15:53:48Z (about 1 year ago)
Mention multiple hops.
  • [Grove's answer][grove] is likewise good, but OpenSSH ([since v7.3][openssh-7.3] in 2016) made it easier still to chain hosts together with `ProxyJump` (`-J`). It's _so easy_ now.
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • Or set them up in _~/.ssh/config_ like this
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
  • [Grove's answer][grove] is likewise good, but OpenSSH made it even easier to chain hosts together with `ProxyJump` (`-J`), introduced in [v7.3][openssh-7.3] in 2016. It's _so easy_ now.
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • Or set them up in _~/.ssh/config_ like this
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • If multiple hops are required to reach the destination, just add an entry for each of them in _~/.ssh/config_ with a `ProxyJump` for the previous hop. You can also do multiple hops with `-J` by comma-separating them.
  • Port forwarding like [Canina's answer][canina] still has important uses, but chaining SSH hops doesn't have to be done that way.
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [canina]: https://linux.codidact.com/posts/282493/282494#answer-282494
#3: Post edited by user avatar Michael‭ · 2023-10-25T15:43:24Z (about 1 year ago)
floating "them" -> actual concrete noun.
  • [Grove's answer][grove] is likewise good, but OpenSSH ([since v7.3][openssh-7.3] in 2016) made it easier still to chain them together with `ProxyJump` (`-J`). It's _so easy_ now.
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • Or set them up in _~/.ssh/config_ like this
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
  • [Grove's answer][grove] is likewise good, but OpenSSH ([since v7.3][openssh-7.3] in 2016) made it easier still to chain hosts together with `ProxyJump` (`-J`). It's _so easy_ now.
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • Or set them up in _~/.ssh/config_ like this
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
#2: Post edited by user avatar Michael‭ · 2023-10-25T15:42:30Z (about 1 year ago)
Add version where ProxyJump was introduced
  • [Grove's answer][grove] is likewise good, but newer versions of OpenSSH make it easier still to chain them together with `ProxyJump` (`-J`). It's _so easy_ now.
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • Or set them up in _~/.ssh/config_ like this
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [Grove's answer][grove] is likewise good, but OpenSSH ([since v7.3][openssh-7.3] in 2016) made it easier still to chain them together with `ProxyJump` (`-J`). It's _so easy_ now.
  • ```bash
  • ssh -J user@interstitial.example me@destination.example
  • ```
  • Or set them up in _~/.ssh/config_ like this
  • ```bash
  • Host interstitial jumper # any number of aliases
  • HostName interstitial.example
  • User user
  • Host destination # again, any number of aliases
  • HostName destination.example
  • User me
  • ProxyJump interstitial # any alias of the jump host
  • ```
  • and just run
  • ```bash
  • ssh destination
  • ```
  • And all of the connection info is handled for you. If the ports are not 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.
  • [grove]: https://linux.codidact.com/posts/282493/282528#answer-282528
  • [openssh-7.3]: https://www.openssh.com/txt/release-7.3
#1: Initial revision by user avatar Michael‭ · 2023-10-25T15:35:36Z (about 1 year ago)
[Grove's answer][grove] is likewise good, but newer versions of OpenSSH make it easier still to chain them together with `ProxyJump` (`-J`). It's _so easy_ now.

```bash
ssh -J user@interstitial.example me@destination.example
```

Or set them up in _~/.ssh/config_ like this

```bash
Host interstitial jumper # any number of aliases
    HostName interstitial.example
    User user

Host destination # again, any number of aliases
    HostName destination.example
    User me
    ProxyJump interstitial # any alias of the jump host
```

and just run

```bash
ssh destination
```

And all of the connection info is handled for you. If the ports are not 22, you can add them to the config. Also, SSH tab-completes hosts in your config file, so you can probably just run `ssh de`\<TAB\>\<RETURN\>.


[grove]: https://linux.codidact.com/posts/282493/282528#answer-282528