How To Wiki

How to forward a port using ssh

1,795pages on
this wiki
Add New Page
Add New Page Talk0

port forwarding using ssh

If you are:

  • working on a computer A that has an ssh client installed
  • have an ssh account (username) on a computer B and you can connect to username from computer A, with the following url (or IP): b
  • want to connect to a computer C but you don't have direct access (because of proxy's and/or firewalls), with the following url (or IP): c

You will be able to create an ssh tunneling or port forwarding that will work with any application connected to localhost or the local IP of your computer. Your application contacts localhost on port pA. The ssh tunnel will forward this to your desired port pC on computer C.

On computer A, open a terminal and type:

ssh -N -L pA:c:pC username@b

Then enter your pasword for username.

Now you can use your application on localhost with port pA in order to connect to c on port pC..

Example: if your account on computer B is bill, if computer B is at, if computer C is at, if you want to connect to subversion on computer C on port 7935, then type in your terminal:

ssh -N -L 9686:

And then in a new terminal:

svn co svn://localhost:9686/repository_name

It will have the same effect as when you type:

svn co svn://

External links Edit

Also on Fandom

Random Wiki