Interview Prep/Linux/Networking, SSH and remote access

You need to reach a database on a private subnet from your laptop through a bastion. How?

BeginnerScenarioNetworking, SSH and remote access
Answer

Situation read → SSH jump host plus local port forwarding.

What I'd do →

ssh -J [email protected] -L 5433:db.internal:5432 [email protected] -N
psql -h localhost -p 5433 -U app

Or permanently in ~/.ssh/config:

Host app01
    HostName app01.internal
    User ops
    ProxyJump bastion.example.com
    LocalForward 5433 db.internal:5432

Why → -J/ProxyJump tunnels the SSH connection through the bastion end-to-end; -L forwards a local port to the target.

Interview tip → Mention that in AWS you'd often use SSM Session Manager port forwarding instead of a bastion.

All Linux questions Roadmap: Linux

More on Networking, SSH and remote access