Debian 8 Jessie
Sponsored Link

SSH Port Forwarding2015/05/02

It's possible to forward a port to another port with SSH port forwarding.
For example, configure the forwarding settings that the 8081 on the local is forwarded to the 5901(VNC) on the local. This example shows simply setting but it's possbile to forward most ports to most ports on the local or on other servers.
[1] Start a VNC process on display #1 with a user, next, Configure like follows.
# forward the connection to 8081 to 5901 on local

ssh -L jessie@localhost

jessie@localhost's password:  
# the password of the working user (it means the login to local to local)

Last login: Sat May 2 22:11:22 2015 from
# confirm

netstat -lnp | grep 8081

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0  *               LISTEN      1920/ssh

# keep this session and go next

# it's possbile to start the process on background as a daemon with "-f" option but then it needs to kill it by hand after working

[2] Next, connect to the port configured above on the local.
[3] Just connected like follows.
Port forwarding with Client Tools
It's possible to use the port forwarding function with tools which has it without configuring servers.
For example, connect to a server with VNC by using Putty's port forwarding.
[5] Start Putty on the ClientPC and specify the destination server.
[6] Select "Connection" - "SSH" - "Tunnels" on the left menu and input any port which is free on the local PC on "Source port" field, and also input "[destination server]:[port]" on "Destination" field. Next, click "Add" button.
[7] Make sure the setting is added and click "Open" button to connect.
[8] Login to the server and keep the session, and go next step.
[9] Start VNC client on the ClientPC and connect to [localhost]:[the port which you set as a source port].
[10] Just connected.
Matched Content