Access linux server port on local machine

Sometimes you need to access any server port to your local machine. In this case SOCKS proxy is helpful. For eg., if you have deployed any app on your server at port 8080 and 8080 port is disabled on the firewall. Then you can make an SSH Tunnel to connect your local port to a server port. In our example let's connect local port 9090 to server port 8080. We have the private key to access Linux server.

 

SSH -L 9090:localhost:8080 -i ~/Documents/Logins/pem/server.pem ubuntu@devstudioonline.com

Here ubuntu is the server's username and devstudioonline.com is a hostname, You can also use the IP address of your server.

After this, you will be connected to the server in the terminal and then open  http://localhost:9090/ in your browser. It will show the content of server port 8080.

Keywords: