Est. read time: 1 minute | Last updated: July 17, 2024 by John Gentile


Network Protections


SSH Tunneling

SSH Tunneling can be used to forward certain ports or services over a secure SSH connection. It’s also useful if a local system wants to expose non-SSH services but only has an SSH port open externally through a router. For example, to tunnel Remote Desktop (RDP) to a remote server <remote>:

$ ssh -L 8888:localhost:3389 <username>@<remote>

You can then connect to the RDP session with localhost:8888.

Also you can forward multiple ports in one connection, for example:

$ ssh -L 8888:localhost:8888 -L 8889:localhost:8889 <username>@<remote>