SSH tunneling (also called port forwarding) allows you to access services running on a remote machine as if they were running locally. It is widely used for Jupyter Notebook, TensorBoard, databases, and internal web services on clusters.

What problem does SSH tunneling solve?

Assume:

SSH tunneling lets you forward a local port to a remote port through an encrypted SSH connection.

From your browser point of view:

localhost:8888  <==SSH TUNNEL==>  remote_server:8888

No public exposure of the remote server is needed.

Local port forwarding (-L)

The most common form of SSH tunneling is local port forwarding:

ssh -L LOCAL_PORT:REMOTE_HOST:REMOTE_PORT user@remote_server

Example:

ssh -L 8888:localhost:8888 user@remote_server

Meaning:

Tunnel-only connection (-N)