1

I am working in Linux environment where my java process is running on Machine C. in order to connect to Machine C from my machine A i need to connect through B for security reason and there is no option to connect directly to machine C.

is there any way to debug the java process that running on machine C.?

Thanks in advance

2
  • You need to set up port forwarding on machine B. Commented Nov 24, 2014 at 17:42
  • Connect to B, and from there, connect to C. Commented Nov 24, 2014 at 17:43

1 Answer 1

3

You can set up a tunnel through machine B. You can use ssh tunneling by issuing this command from machineA:

ssh root@machineB -L 5005:machineC:5005

You will need to configure your IDE to debug remotely, pointed at machineA port 5005, and configure the remote JVM on machineC for remote debugging on port 5005, something like this:

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005

Assuming your IDE is running on the same machine as the ssh client, that is, machineA, you can point your IDE to localhost:5005 and the ssh command will attempt to tunnel all connections you make to localhost:5005 through to machineC:5005.

Sign up to request clarification or add additional context in comments.

3 Comments

Do i need to set the tunneling from machine B , how can i do it? Thanks
do i need to do it under:(/etc/ssh/sshd_config or /etc/openssh/sshd_config
The ssh command creates the tunnel, but I need to edit the answer, because it's incorrect about where you point your IDE debugging session. The -L option listens locally, that is, on machineA, not on machineB as I stated. My apologies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.