[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to open ssh tunnel port ?



On 27/06/2012 15:37, J. Bakshi wrote:

Dear list,

I have made a successful ssh tunnel between two pcs A and B.
A is running mysql and B have the tunnel with A , so that B
can access that remote mysql with its local port 3360. Everything
is fine......

But B is bind the port with localhost only, hence no one can access
B's 3360 port. How can B open the port so that others can also
use the 3360 port on B which is actually tunneled with A ?

<A running mysql>  ------tunnel-----<B localhost:3360>
but<c>  can't see 3360 on<B>

Thanks



Hi,

Your current ssh command (assuming you are connection from B to A) presumably looks something like:

ssh -L 3360:localhost:3306 A

According to the ssh man page (try running "man ssh" and read the bit about the '-L' argument), you can specify the bind address as part of that argument. Basically you should end up with something like this:

ssh -L 192.168.0.1:3360:localhost:3306 A

where '192.168.0.1' is the ip address you want to bind to (i.e. the ip address of eth0, or whichever interface you want to use). The same method applies if you are using -R to create the tunnel the other way - again read the manual page, it's there to help you!

I would think carefully about whether you really want to do this, as you will be exposing the mysql server to anyone who can connect to machine B on port 3360. Security is one of the main motivators for binding only to localhost by default (by both mysql and ssh).

Regards,
Laurence


Reply to: