Tunneling

Local forward

ssh -N -L 8080:localhost:80 user@host

Forwards a local port to the remote. Listens on port 8080 and reaches port 80 on host; see ssh(1).

Remote forward

ssh -N -R 9000:localhost:5432 user@host

Forwards a remote port to your machine. Listens on port 9000 on host and reaches port 5432 locally; see ssh(1).

SOCKS proxy

ssh -N -D 1080 user@host

Routes traffic through a SOCKS proxy. Opens a local proxy on port 1080 and sends traffic through host; see ssh(1).

Background tunnel

ssh -fN -L 8080:localhost:80 user@host

Runs the tunnel in the background. -f backgrounds it and -N skips the remote shell; see ssh(1).

0 Comments for this cheatsheet. Write yours!