java-ssh-tunnel
└── src
└── main
├── java
│ └── dev
│ └── darshit
│ └── java_ssh_tunnel
│ ├── Main.java
│ ├── MultiTunneler.java
│ ├── Tunneler.java
│ └── ssh
│ ├── TunnelDetails.java
│ └── UserDetails.java
└── resources
- Download the project
- Load up in your IDE
- Run
mvn clean install
- Change
Main.java
with required details like SSHusername
, SSHpassword
, JumpHostsshHost
- (Optional) Maybe load up
localPort
,remoteHost
, andremotePort
details from a file - Run
Main.java
If all things go well, you'll see following output on your stdout
Starting tunneling...
<remoteHost>:<remotePort> is available on localhost:<localPort>
Press Enter to terminate the tunnels...
While the above is very convenient, DO NOT USE IT TO CONNECT TO PROD
Read my blog post on the same: https://darshit.dev/posts/java-ssh-tunnel/