Ask Steves · Daily notes · VPS, 20% off · AI Profit Lab · SEO · Money Hub

18 November 2026 · One command a day

How do I tunnel a remote app to my laptop with SSH?

An SSH tunnel takes a port on your laptop and passes everything sent to it through to a port on your server. Use it when an app on the server only listens on localhost and you want to open it in your own browser without exposing it to the internet.

I learn my automation tips in the AI Profit Boardroom. Have a look here. Affiliate link.

The command

ssh -L 8080:localhost:3000 user@host

-L asks for local port forwarding. 8080 is the port that opens on your laptop. localhost:3000 is where the traffic goes, and it is read from the server's side, so localhost here means the server itself, not your laptop. user@host is your normal SSH login. While this session stays open, visiting http://localhost:8080 on your laptop reaches the app on port 3000 on the server.

What you will see

$ ssh -L 8080:localhost:3000 user@host
Welcome to Ubuntu 24.04.1 LTS (GNU/Linux 6.8.0-49-generic x86_64)
user@host:~$

# in a second terminal on your laptop
$ curl -I http://localhost:8080
HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: text/html; charset=utf-8

The first part looks like an ordinary login, because it is one. The tunnel runs quietly in the background of that session. The second part proves it works: a request to port 8080 on your laptop came back with a response from the app on the server. Close the SSH session and the tunnel closes with it.

When to use it

Watch out for

If something on your laptop already uses port 8080, SSH prints bind [127.0.0.1]:8080: Address already in use and Could not request local forwarding, then logs you in anyway. It is easy to miss, and the browser then shows whatever else owns that port, or nothing. Read the lines above the prompt, and if you see that warning, pick another local port such as -L 8081:localhost:3000. Also check the app is actually running on the server: a connection refused on the server side shows up as channel 2: open failed in your SSH session.

Questions people ask

Can I run the tunnel without opening a shell?

Yes. Add -N to forward the port without running a remote command, for example ssh -N -L 8080:localhost:3000 user@host, and press Ctrl+C to stop it.

Does this make the app public?

No. By default the laptop end only listens on 127.0.0.1, and the server end connects over the encrypted SSH session, so your firewall can keep port 3000 closed. Logging in with a key makes this smoother, see how to copy your SSH key to a server.

Tunnelling into a private app like this needs SSH access to a server you control, which shared hosting rarely gives you. You can get the same VPS with 20% off at https://asksteves.co.uk/vps. Affiliate link.

Want more automation tips? The AI Profit Boardroom on Skool is where I get mine. Have a look here. Affiliate link.

Everything on this blog runs on one Hostinger KVM 8. This link takes 20% off the same box.

GET A VPS, 20% OFF →

Affiliate link.

Related server notes: How do I check a website's status code and headers from the command line? · How do I copy a file to or from a server with scp? · How do I copy a folder to another server with rsync? · All daily notes