ANANDHAN SUBBIAH - INSPIRE AND INNOVATE



Creating a SSH Tunnel in a MAC

Writing by Anandhan Subbiah on Thursday, 6 of December , 2007 at 1:07 pm

Typically there are two machines involved when creating a SSH Tunnel.

1) The machine with the public facing IP.

2) The machine which does is not available to the public but certain ports are open for outside access. For example if mysql is running on the box then port 3306 is reachable using the public facing machine.

Here is the command to do this:

ssh -N -L 1222:private.machine.com:3306 user@public.machine.com

-N means that no shell is required

-L is the localport ( which means you can connect to 127.0.0.1:1222 to access the mysql instance inside a firewall. You cannot use localhost here as mysql goes crazy and tries to establish a direct socket connection to the local host ignoring the tunnel that you created. )

private.machine.com:3306 host name and port of the machine hosting mysql.

user@public.machine.com credentials to the public facing machine.

Leave a comment

Category: General programming Concepts, Technical Articles

  • Register
  • anandhansubbiah.com

    Anandhan Subbiah

    I always wanted to share the things I have learnt over the years as a software engineer and I honestly believe that I can achieve that using this blog . I will publish technical articles related to design and coding. I will also review cool products and presentthe issues I have faced  using diffrent applications.I am not a major animal activist by any means but i react  to killing without reason and inhumane treatment of animals so there will be some articles linking to PETA.org