Master SSH ProxyJump for Secure Multi-Hop Connections
This video teaches you how to securely connect to internal SSH hosts using ProxyJump to prevent exposing sensitive jump hosts.
What this guide covers
After this guide, you’ll be able to configure and use SSH ProxyJump to securely connect to internal SSH hosts through an intermediate bastion (jump) host, reducing exposure of sensitive infrastructure while maintaining simple access.
When to use it
- Accessing internal servers behind a firewall through a bastion host without directly exposing them.
- Managing SSH sessions in environments where multiple hops are required to reach the target server.
- Securing enterprise SSH workflows by preventing direct login to jump hosts.
- Automating SSH connections in scripts or tools that need multi-hop access.
The move, step by step
-
Open or create your SSH config file at
~/.ssh/config. -
Define the bastion (jump) host entry with its hostname and user:
Host bastion-host HostName bastion.example.com User ec2-user -
Define your internal host and specify the ProxyJump directive pointing to the bastion:
Host internal-server HostName 10.0.0.5 User ec2-user ProxyJump bastion-host -
Save the config file and set appropriate permissions:
chmod 600 ~/.ssh/config -
Connect directly to the internal server using:
ssh internal-serverSSH will automatically route through
bastion-hostwithout exposing it in your commands. -
Optionally, for multi-hop beyond one jump, chain hosts separated by commas:
ProxyJump bastion-host,second-jump -
Always verify connectivity and update host keys to avoid MITM alerts (
ssh-keyscanhelps for automation).
Example
Input: You want to ssh to internal-server at 10.0.0.5 via your bastion at bastion.example.com.
Your ~/.ssh/config contains:
Host bastion-host
HostName bastion.example.com
User ec2-user
Host internal-server
HostName 10.0.0.5
User ec2-user
ProxyJump bastion-host
Command:
ssh internal-server
Expected output snippet:
ec2-user@internal-server's password:
Last login: Wed Jun 5 11:42:07 2024 from bastion.example.com
[ec2-user@internal-server ~]$
You connect transparently through the bastion without exposing the bastion in direct SSH commands or logs.
Common mistakes
- Mistake: Using
ProxyCommandwith old syntax → Fix: UseProxyJumpdirective for simpler, supported multi-hop chaining (OpenSSH 7.3+). - Mistake: Not matching
Hostaliases consistently → Fix: Use clear alias names and ensure they match betweenProxyJumpandHost. - Mistake: Leaving
~/.ssh/configworld-readable → Fix: Set permissions to600to keep SSH config private. - Mistake: Directly SSH-ing to bastion hosts from external networks → Fix: Restrict bastion access by IP and use ProxyJump for internal host access.
- Mistake: Forgetting to update SSH keys for bastion or internal servers → Fix: Regularly verify fingerprint with
ssh-keyscanto avoid man-in-the-middle risks.
Next step
Update your SSH config today by adding a ProxyJump block for one internal host you access frequently. Test the connection and confirm it routes properly. Then come back and try the next move from the video.
Pick the smallest version of this guide and try it in your tool of choice in the next 20 minutes.
Get the next AI/career guide in your inbox
One short, practical guide on AI tools, cloud, and the modern career stack. No fluff.