Quick SSH Tunnel using Putty

Two easy steps to create a tunnel from a remote server port to your localhost. It’s handy if you’re trying to connect to a mysql, jboss, etc. installation bound to localhost only (for better security. Check out the screenshots after the break

1- Add the remote server’s information (Session)

2- Add the tunnel information (Connection – SSH – Tunnels)

You need to edit the Source port and Destination then click the “Add” button.

This should be enough. Either go back to the “Session” screen and save the configuration for later. Or simply click “Open” to get started.

Creating an SSH tunnel or forwarding ports is pretty easy when you’re on a Linux machine. Simply type the following in the shell:

ssh -fLN 8080:127.0.0.1:8080 myserver.tld

Where the first 8080 is the local port and the second 8080 is the port on the server.

Practically, let’s say you have a glassfish installation on your server at 10.0.10.15. You cannot access the admin port 8484 on that server as it’s by default bound to localhost only. So, you can create a tunnel using the following command and access the glassfish admin site as if it’s on the local machine at http://127.0.0.1:8484/:

ssh -fLN 8484:127.0.0.1:8484 10.0.10.15

Similar Posts:

Tagged , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *