Table of Contents

SSH

Static Forwarding

Local forwarding:

ssh -L8021:<dist>:21 <host>

Remote forwarding (you need to set “GatewayPorts yes” in sshd_config if you want to access the port from other addresses than localhost, then “/etc/init.d/sshd reload”):

ssh -R8021:<dist>:21 <host>

Dynamic Forwarding

Use another machine as a proxy, turning localhost into a SOCKS proxy, eg on port 8080:

ssh [-fN] -D8080 <host>

It may be a good idea to open a ssh server on a web port (80/8080/443), because you will need to use this when you have a restricted connection, and port 22 may be forbidden as well (just add Port 22 AND Port 80 to sshd_config, or configure NAT port forwarding on your router, and then use ssh -p <port> <host>…).

Then configure your apps to use it:

You can do something similar and maybe more powerful with proxychains.

RSYNC protocol proxy:

export RSYNC_CONNECT_PROG='ssh <host> nc %H 873'

Complete Forwarding

Forward all the traffic so you don't have to configure every application.