KWLUG Ten SSH Tricks #10

Doing Port-Forwarding

Say your email program connects to the pop3 port (110) on remotehost.

This tunnels port 9110 on your local computer to port 110 on remotehost.

      ssh -L 9110:remotehost:110 daniel@remotehost
  • you tell your email program to connect to port 9100 on localhost

    • data is encrypted and connection can tunnel through a firewall or sympatico's port-block.

  • two other switches:

    • -N (don't run a command, just open connection)

    • -f (fork into the background)

  • need to be root to forward from "privilaged" local ports (lower than 1024)

    • useful if a program won't let you change the port

      ssh -N -f -L 25:coder.com:25 daniel@coder.com
  • stack 'em

      ssh -N -f -L 110:mailhost:110 -L 25:mailhost:25 daniel@coder.com

<< Previous | Index | Next >> Copyright © 2002 Daniel Allen