Your server is full of useful dashboards: Netdata for live metrics, a database admin tool, maybe a local AI model. Every one of them is a door you do not want open to the internet. An SSH tunnel lets you walk through those doors from your laptop while they stay locked for everyone else. One command, nothing to install, and you can finish this in 15 minutes.
What you will build
By the end, you will open http://localhost:19999 on your own laptop and see your server’s Netdata dashboard, even though the server’s firewall has port 19999 firmly closed.

Every command and every bit of output in this guide was run for real against an Ubuntu 26.04 server running Netdata v2.12.
What you need
- A Linux server you can already log in to with
ssh(a key login is best). - A service on that server that listens only on
127.0.0.1. We use Netdata on port 19999; any other works the same way. - A laptop with OpenSSH. macOS and Linux have it built in, and so does Windows 10 and later (
sshin PowerShell). - About 15 minutes. Cost: free.
In the examples, the server is 203.0.113.10 and the login is deploy. Use your own.
Step 1: check the dashboard is private
On the server, see which address the service listens on:
sudo ss -ltnp | grep 19999
LISTEN 0 4096 127.0.0.1:19999 0.0.0.0:* users:(("netdata",...))
127.0.0.1 means “this machine only”. Nothing outside the server can connect, which is exactly what we want. If you see 0.0.0.0:19999 instead, the dashboard is open to the world. For Netdata, set bind to = 127.0.0.1 in the [web] section of /etc/netdata/netdata.conf and restart it.
From your laptop, prove it is closed to you too:
curl http://203.0.113.10:19999/
The request just hangs and times out. Good: the firewall and the bind address are both doing their job.
Step 2: open the tunnel
On your laptop, run:
ssh -N -L 19999:127.0.0.1:19999 [email protected]
It logs in and then seems to do nothing. That is correct: it is now holding the tunnel open. Leave this terminal running.

The key part is -L 19999:127.0.0.1:19999. Read it as: “open port 19999 on my laptop, and send whatever arrives there to 127.0.0.1:19999 as seen from the server“. The middle address is looked up on the server, so 127.0.0.1 means the server itself, not your laptop.
Your SSH server listens on a different port, or you use a specific key? Add them as usual: -p 2022 -i ~/.ssh/my_key.
Step 3: open the dashboard
Open http://localhost:19999 in your browser. That is your server’s Netdata, live.
Here is the same check from a second terminal, before, during and after the tunnel:
$ curl http://localhost:19999/ # before the tunnel
curl: (7) Failed to connect to localhost port 19999 after 0 ms: Couldn't connect to server
$ curl -s -o /dev/null -w "HTTP %{http_code}\n" http://localhost:19999/ # tunnel open
HTTP 200
And on your laptop you can see who is listening on that port: it is ssh itself, on your loopback address only.
$ lsof -nP -iTCP:19999 -sTCP:LISTEN
ssh 127.0.0.1:19999 (LISTEN)
ssh [::1]:19999 (LISTEN)
Step 4: close it
Press Ctrl+C in the tunnel terminal. The door closes instantly:
$ curl http://localhost:19999/
curl: (7) Failed to connect to localhost port 19999 after 0 ms: Couldn't connect to server
How it works

- Your browser connects to port 19999 on your laptop.
- The
sshprogram owns that port. It takes the request and wraps it inside your existing, encrypted SSH connection. - The firewall sees only a normal SSH login on the SSH port, which it already allows.
sshdon the server unwraps the request and opens a connection to127.0.0.1:19999.- Netdata sees a visitor from the server itself, which is the only place it accepts visitors from, and replies.
- The reply travels back the same way.
Nothing new is open on the server. The only key to this door is your SSH login.
Make it one short command
Typing the full command gets old. Add a shortcut to ~/.ssh/config on your laptop:
Host netdata-tunnel
HostName 203.0.113.10
User deploy
IdentityFile ~/.ssh/id_ed25519
LocalForward 19999 127.0.0.1:19999
ExitOnForwardFailure yes
ServerAliveInterval 30

Now this is all you type:
ssh -f -N netdata-tunnel
-f sends the tunnel to the background and gives you your prompt back. ExitOnForwardFailure yes makes ssh stop with an error instead of silently running without a tunnel, and ServerAliveInterval 30 keeps an idle tunnel from being dropped. To close a background tunnel, find its process and stop it: pkill -f netdata-tunnel.
The same trick works for anything on localhost
Change the ports and you can reach any private service. A database, for example: MySQL and MariaDB listen on 3306, and here we map it to 3307 on the laptop so it cannot clash with a local database:
ssh -N -L 3307:127.0.0.1:3306 [email protected]
$ nc -z localhost 3307
Connection to localhost port 3307 succeeded!
Point your database app at 127.0.0.1, port 3307, and log in with the database user as usual. The same pattern works for a private AI model server such as Ollama, whose default port is 11434: -L 11434:127.0.0.1:11434. (We did not run Ollama for this guide; the command is the same shape.)
You can also open several doors in one go by repeating -L:
ssh -N -L 19999:127.0.0.1:19999 -L 3307:127.0.0.1:3306 [email protected]
Troubleshooting

“bind [127.0.0.1]:19999: Address already in use”
bind [127.0.0.1]:19999: Address already in use
channel_setup_fwd_listener_tcpip: cannot listen to port: 19999
Could not request local forwarding.
Something on your laptop already uses that port, very often a tunnel you opened earlier and forgot. Find it with lsof -nP -iTCP:19999 -sTCP:LISTEN, close it, or pick a different local port: -L 29999:127.0.0.1:19999 and open localhost:29999.
“channel 2: open failed: connect failed: Connection refused”
The tunnel is fine, but nothing on the server listens on the target port. In the browser it looks like a reset connection (curl: (56) Recv failure: Connection reset by peer). Check the port on the server with sudo ss -ltnp, and check the service is running.
The SSH login itself fails or hangs
The tunnel is only as reachable as SSH. If your server only allows SSH from certain IP addresses and your home IP has changed, update the firewall rule first. Test a plain ssh [email protected] before debugging the tunnel.
When to use something else

- Just you, now and then: an SSH tunnel. Nothing to set up, nothing to keep patched.
- You want a normal web address that works from any device: put the dashboard behind an identity-aware proxy such as Cloudflare Access, with a login only you can pass.
- A team, or many services that should always be reachable: a VPN such as WireGuard or Tailscale.
Make it yours
- Add a second
LocalForwardline to your config so one command opens both Netdata and your database. - Open a tunnel to a service you thought you had to expose, and close its public port for good.
- Build it, then tell us in the comments which dashboard you set free.
FAQ
Is an SSH tunnel secure? It is as secure as your SSH login: traffic is encrypted, and only someone who can log in can open the tunnel. Use a key, not a password, and keep SSH limited to the people who need it.
Can other people on my Wi-Fi use my tunnel? Not by default. ssh listens on 127.0.0.1 on your laptop, so only programs on your own machine can use it.
What is the difference between -L and -R? -L (local) brings a server port to your laptop, which is what this guide does. -R (remote) does the opposite: it shares a port from your laptop on the server.
Does it work on Windows? Yes. Windows 10 and later include OpenSSH. The same ssh -N -L ... command works in PowerShell.
Summary
An SSH tunnel turns “open a port for this dashboard” into “log in, then look”. Keep admin tools on 127.0.0.1, keep the firewall closed, and use ssh -N -L local:127.0.0.1:remote whenever you need a look. For more on keeping a shared server tight, read one PHP-FPM pool per site, secrets management for a multi-app server and agent security and governance.




Join the discussion