Stop your SSH agent from clobbering your session when you jump between servers
SSH & Remote Administration
Stop your SSH agent from clobbering your session when you jump between servers
🧩 The Challenge
Dealing with SSH agent forwarding is usually fine until you realize you’ve left your local keys exposed on a jump box you just compromised or abandoned. It’s a security headache that’s bitten me more than once when I’ve had to audit a dozen boxes after a contractor left.
💡 The Fix
Use ProxyJump instead of agent forwarding to keep your keys safely on your local machine. It moves the traffic through the middle server without handing over your authentication credentials.
ssh -J user@jumpbox.example.com user@target-server.com
⚙️ Why It Works
This tells your local SSH client to act as a bridge, setting up a secure pipe directly to the final host. Because the jump server never sees your private keys, you don’t have to worry about them getting hijacked if that intermediate box is untrustworthy.
🚀 Pro-Tip: Stick ‘ProxyJump jumpbox’ into your ~/.ssh/config for that specific host and stop typing the command entirely.
Linux Tips & Tricks | © ngelinux.com | 8/10/2026
