Reach private services through an SSH tunnel
Updated 27 Nov 2026 ssh tunnel
Open a database or admin page securely without exposing it to the internet.
A tunnel carries a port through your SSH connection, so the service can stay bound to 127.0.0.1.
Reach a service on the server
ssh -N -L 5433:127.0.0.1:5432 root@203.0.113.10
While this runs, connecting to localhost:5433 on your computer reaches PostgreSQL on the server. -N means no remote shell.
A web admin page
ssh -N -L 8080:127.0.0.1:8080 root@203.0.113.10
Then open http://localhost:8080.
Save it
In ~/.ssh/config:
Host db-tunnel
HostName 203.0.113.10
User root
LocalForward 5433 127.0.0.1:5432
ssh -N db-tunnel
Keep it from dropping
Add ServerAliveInterval 60.
Use responsibly
Tunnels are for reaching your own services. Running open proxies or relays breaks the Acceptable Use Policy.