Difference between revisions of "SSH"

From WTFwiki
Jump to navigation Jump to search
(Added page on ssh port forwarding)
 
Line 7: Line 7:
 
   ssh -L [bind_address:]port:host:hostport remote_host
 
   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.
+
bind_address is optional and can be used to bind to a specific IP on the local machine (defaults to loopback).
  
 
For example, if I wanted to do X11 forwarding over a firewall:
 
For example, if I wanted to do X11 forwarding over a firewall:

Revision as of 12:24, 11 January 2007

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 (defaults to loopback).

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