2

I am trying to make a ssh tunnel connection to a remote server that has different SSH port.

My PC

hostname: fooserver.com

IP address: 10.25.0.186

SSH port: 63354

My Remote PC

hostname: barserver.com

IP address: 10.26.0.183

SSH port: 63354

Now I want to connect in my Remote PC's MySQL server by using "localhost" by doing the SSH tunnel command below.

ssh -L 3306:localhost:3306 [email protected]

But after issuing the command above it show an error after few moments.

connect to host barserver.com port 22: Network is unreachable

It's very obvious that my PC tries to connect to SSH standard port but remote PC is running its SSH port to 63354. How can set the ssh port in the ssh tunnel command

I tried the following below.

ssh -L 3306:localhost:3306 [email protected]:63354

but it says its an invalid hostname.

5
  • 1
    Try ssh -L 3306:localhost:3306 -p 63354 [email protected].
    – MadHatter
    Commented Apr 14, 2016 at 15:45
  • hello @MadHatter Please post your answer :) you got it right :)
    – Olga Real
    Commented Apr 14, 2016 at 15:47
  • 1
    Honestly, whilst I like acceptance points as much as the next chap, it really doesn't deserve a Server Fault question. If you are grateful for the help, the best thing you can do is to please just delete this question, or flag a moderator and ask for it to be moved to SU, or to unix.SE.
    – MadHatter
    Commented Apr 14, 2016 at 15:48
  • Why i got a downvote?
    – Olga Real
    Commented Apr 14, 2016 at 15:48
  • Mouse over the down arrow; the popup says "This question does not show any research effort; it is unclear or not useful". Downvotes without comment may be presumed to be for at least one of those reasons.
    – MadHatter
    Commented Apr 14, 2016 at 15:49

1 Answer 1

5

Try ssh -L 3306:localhost:3306 -p 63354 [email protected]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .