Forward remote port to local using ssh

Assume you have a remote host with ip rhost_ip and user remote_user which you can connect by ssh (22 port).

Assume you need to connect from localhost to port 8080 (or any other), But you have no 8080 ports allowed/forwarded to public ip (rhost_ip).

In this case, you can forward it over ssh:

ssh -L 8080:localhost:80 remote_user@rhost_ip

This will start ssh session and make forwarding which will live with the session.

Then just connect to localhost:8080 and it will access you to remote host port 80.

Note: 8080 port should not be already used(binded) on localhost before run ssh command.
#ssh #port-forwarding #security
menu 1
Ivan Borshchov profile picture
Feb 24, 2017
by Ivan Borshchov
Did it help you?
Yes !

Best related

Other by Ivan Borshchov