SSH (OpenSSH) 10 cheatsheet

SSH (OpenSSH) 10: Port forwarding

5 common SSH (OpenSSH) 10 tasks.

Reach a remote service locally

Make a remote database available at localhost:5433, through the server.

ssh -L 5433:localhost:5432 [email protected]

Expose a local service on the server

Make your local web server available on the server's port 8080.

ssh -R 8080:localhost:3000 [email protected]

Create a SOCKS proxy

Run a SOCKS5 proxy on localhost:1080 that sends traffic through the server.

ssh -D 1080 [email protected]

Run a tunnel in the background

Forward a port without opening a shell. -N means no command, -f means go to the background.

ssh -fN -L 5433:localhost:5432 [email protected]

Stop a background tunnel

Find and end the tunnel process.

pkill -f 'ssh -fN -L 5433'

Was this page helpful?