Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

Bind to a Remote Port Using SSH

July 10, 2023 — Gregg Szumowski

If you are trying to access the web page of an application running on a remote machine and you find that you are blocked, you can bind to it using SSH with similar parameters to this:

$ ssh pi@raspberrypi.local -L 8384:127.0.0.1:8384 -N

Where:

  • pi@raspberrypi.local is the remote server,
  • 8384 is the port number on the remote that you wish to connect with,
  • 127.0.0.1:8384 is the local machine and the port that you want to redirect to, and
  • -N is a flag telling ssh not to execute a remote command.

Tags: cli, ssh, motd