SSH & Remote Administration
Stop exposing dev ports to the world
đź§© The Challenge
Ever spin up some little dev service, maybe a local web app or a database GUI, on a remote server and then find yourself scratching your head trying to reach it? You know it’s running, probably listening on `127.0.0.1:8080` or something similar, but opening up the firewall or messing with `ListenAddress` feels dirty and insecure for something that’s just for you. Nobody wants to expose a random dev port to the entire internet for quick access. This stuff is supposed to be *easy*.
đź’ˇ The Fix
What you need is an SSH local port forward. It builds a secure tunnel right through your existing SSH connection, making that remote port act like it’s running right on your workstation. It’s safe, quick, and keeps those pesky firewall rules exactly where they belong.
ssh -N -L 8080:localhost:8080 user@remoteserver.example.com
⚙️ Why It Works
This command tells your local SSH client to listen on port `8080` (the first `8080`). When anything connects to it, SSH sends that traffic securely over the tunnel to `remoteserver.example.com`. Once it arrives there, the SSH server on `remoteserver` forwards it to `localhost:8080` (the second `8080` and `localhost`) *from its perspective*. The `-N` means “don’t execute a remote command,” so it just sets up the tunnel without opening an interactive shell.
🚀 Pro-Tip: Pair this with `-f` to background it immediately. You can `ps -ef | grep ssh` and `kill` the specific process when you’re done.
Linux Tips & Tricks | © ngelinux.com | 10/21/2026
