SSH tunnels allow secure access to remote services through encrypted connections.
Local forwarding¶
ssh -L 5433:localhost:5432 user@db-server ssh -L 8080:internal-app:80 user@bastion
Remote forwarding¶
ssh -R 8080:localhost:3000 user@public-server
Dynamic (SOCKS)¶
ssh -D 1080 user@ssh-server curl –socks5 localhost:1080 http://internal.local
Jump host¶
ssh -J bastion user@internal-server
SSH Tunnels and Port Forwarding¶
Host internal-* ProxyJump bastion
Persistent Tunnels¶
autossh -M 0 -f -N -L 5433:localhost:5432 user@db-server
SSH Tunnels = Secure Access¶
For production use autossh or systemd. For more complex scenarios use VPN.
sshtunelyport forwarding