Interview Prep/Linux/Networking, SSH and remote access

You need SSH access to a server behind NAT with no inbound ports open. How?

AdvancedScenarioNetworking, SSH and remote access
Answer

Situation read → The server must call out; use a reverse tunnel or an agent.

What I'd do →

  1. Reverse tunnel from the server to a relay:
autossh -M 0 -N -o ServerAliveInterval=30 -R 2222:localhost:22 [email protected]

Then from the relay: ssh -p 2222 user@localhost. 2. Run it as a systemd service so it restarts. 3. Production-grade: an outbound-only agent (AWS SSM, Teleport, Tailscale).

Why → NAT allows outbound connections; the tunnel carries traffic back in.

Interview tip → Mention locking down the relay with GatewayPorts no so the forwarded port isn't public.

All Linux questions Roadmap: Linux

More on Networking, SSH and remote access