SSH

From WTFwiki
Revision as of 11:22, 11 January 2007 by Andrew (talk | contribs) (Added page on ssh port forwarding)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

SSH port forwarding is a magical technique that allows you to tunnel a port over ssh to a remote machine. It is useful in traversing firewalls and suchlike.

Tunneling ports to the local machine

To tunnel a remote port to a port on the local machine use ssh -L.

 ssh -L [bind_address:]port:host:hostport remote_host

bind_address is optional and can be used to bind to a specific IP on the local machine.

For example, if I wanted to do X11 forwarding over a firewall:

 ssh -L 6000:myworkstation.work:6000 firewall.work

This would create a ssh connection to the firewall firewall.work, open a tunnel through to myworkstation.work on port 6000 and open a port on the local machine (the one you ran the ssh command from) on port 6000(which might be a bad idea for X11).

Tunneling ports to a remote machine

TODO - ssh -R