How to tunnel access to your application server with SSH

Here’s a step-by-step tutorial on how to reach your application server ( for example WIldFly or Tomcat) running on http://192.168.10.1:9990 from outside using an SSH tunnel. We will show an example using the ssh command and another using Putty.

Step 1: Configure SSH Access to Your Local Machine

Ensure that your local machine has SSH access enabled and that you can connect to it remotely. If necessary, set up port forwarding or configure your router/firewall to allow incoming SSH connections.

Step 2: Install SSH Client (If Required)

If you’re connecting from a different machine, ensure that you have an SSH client installed. Most Linux distributions come with an SSH client preinstalled, but for Windows, you can use programs like PuTTY or OpenSSH.

Step 3: Establish an SSH Connection

  • Open a terminal or SSH client on the machine from which you want to access the JBoss server.
  • Run the following command to establish an SSH connection and create the tunnel:
    ssh -L 9990:192.168.10.1:9990 user@your_local_machine_ip
  • Replace user with your username and your_local_machine_ip with the public IP address or hostname of your local machine.

Step 4: Enter Authentication Credentials

Enter your password when prompted to authenticate the SSH connection.

Step 5: Access the JBoss Management Console

Once the SSH connection is established, you can access the JBoss Management Console in your local browser by visiting http://localhost:9990.

  • If you’re connecting from a different machine, use the public IP address or hostname of the machine running the SSH client instead of localhost.

Step 6: Interact with the JBoss Server

You should now be able to interact with the JBoss server as if you were accessing it directly on your local network. You can configure, manage, and monitor your JBoss instance through the Management Console.

Step 7: Keep the SSH Connection Active

Keep the terminal or SSH client open to maintain the SSH tunnel and access the JBoss server remotely. If you close the terminal or terminate the SSH session, the tunnel will be closed as well.

Example: SSH Tunnelling using Putty

Let’s say you have the management http console running on 192.168.10.1 port 9990 which cannot be directly accessed by your machine. Here’s how to operate. Click on “Preferences” in putty and expand Connection | SSH. Once there:

1) In source port enter the port that will be used on your machine to access the remote socket

2) In destination enter the remote address/port we want to reach (e.g. 192.168.10.1:9990)

3) Click on Add and Apply:

how to ssh tunnel jboss tomcat

That’s all! Now point your browser to localhost:9990 and it will redirect to 192.168.10.1:9990.

You have successfully set up an SSH tunnel to access your local JBoss server from outside. Remember to ensure that your local machine has a stable internet connection and the necessary firewall or router configurations to allow incoming SSH connections.

Found the article helpful? if so please follow us on Socials